@@ -89,7 +89,9 @@ import Development.IDE.Types.Options
8989import Development.IDE.GHC.CoreFile
9090import GHC (ForeignHValue ,
9191 GetDocsFailure (.. ),
92- parsedSource )
92+ parsedSource ,
93+ GhcException (.. )
94+ )
9395import qualified GHC.LanguageExtensions as LangExt
9496import GHC.Serialized
9597import HieDb
@@ -1301,12 +1303,20 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do
13011303 case maybe_recomp of
13021304 Just msg -> do_regenerate msg
13031305 Nothing
1304- | isJust linkableNeeded -> do
1305- (core_file@ CoreFile {cf_iface_hash}, core_hash) <- liftIO $ readBinCoreFile (mkUpdater $ hsc_NC session) core_file
1306+ | isJust linkableNeeded -> handleErrs $ do
1307+ (core_file@ CoreFile {cf_iface_hash}, core_hash) <- liftIO $
1308+ readBinCoreFile (mkUpdater $ hsc_NC session) core_file
13061309 if cf_iface_hash == getModuleHash iface
13071310 then return ([] , Just $ mkHiFileResult ms iface details runtime_deps (Just (core_file, fingerprintToBS core_hash)))
13081311 else do_regenerate (RecompBecause " Core file out of date (doesn't match iface hash)" )
13091312 | otherwise -> return ([] , Just $ mkHiFileResult ms iface details runtime_deps Nothing )
1313+ where handleErrs = flip catches
1314+ [Handler $ \ (e :: IOException ) -> do_regenerate (RecompBecause $ " Reading core file failed (" ++ show e ++ " )" )
1315+ ,Handler $ \ (e :: GhcException ) -> case e of
1316+ Signal _ -> throw e
1317+ Panic _ -> throw e
1318+ _ -> do_regenerate (RecompBecause $ " Reading core file failed (" ++ show e ++ " )" )
1319+ ]
13101320 (_, _reason) -> do_regenerate _reason
13111321
13121322-- | Find the runtime dependencies by looking at the annotations
0 commit comments