Skip to content

Commit eac0234

Browse files
committed
Handle exceptions when reading core files
1 parent 3df38c1 commit eac0234

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ghcide/src/Development/IDE/Core/Compile.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,12 +1301,14 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do
13011301
case maybe_recomp of
13021302
Just msg -> do_regenerate msg
13031303
Nothing
1304-
| isJust linkableNeeded -> do
1305-
(core_file@CoreFile{cf_iface_hash}, core_hash) <- liftIO $ readBinCoreFile (mkUpdater $ hsc_NC session) core_file
1304+
| isJust linkableNeeded -> handleErrs $ do
1305+
(core_file@CoreFile{cf_iface_hash}, core_hash) <- liftIO $
1306+
readBinCoreFile (mkUpdater $ hsc_NC session) core_file
13061307
if cf_iface_hash == getModuleHash iface
13071308
then return ([], Just $ mkHiFileResult ms iface details runtime_deps (Just (core_file, fingerprintToBS core_hash)))
13081309
else do_regenerate (RecompBecause "Core file out of date (doesn't match iface hash)")
13091310
| otherwise -> return ([], Just $ mkHiFileResult ms iface details runtime_deps Nothing)
1311+
where handleErrs = flip catch $ \(e :: IOException) -> do_regenerate (RecompBecause $ "Reading core file failed (" ++ show e ++ ")")
13101312
(_, _reason) -> do_regenerate _reason
13111313

13121314
-- | Find the runtime dependencies by looking at the annotations

0 commit comments

Comments
 (0)