@@ -89,7 +89,9 @@ import Development.IDE.Types.Options
89
89
import Development.IDE.GHC.CoreFile
90
90
import GHC (ForeignHValue ,
91
91
GetDocsFailure (.. ),
92
- parsedSource )
92
+ parsedSource ,
93
+ GhcException (.. )
94
+ )
93
95
import qualified GHC.LanguageExtensions as LangExt
94
96
import GHC.Serialized
95
97
import HieDb
@@ -1301,12 +1303,20 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do
1301
1303
case maybe_recomp of
1302
1304
Just msg -> do_regenerate msg
1303
1305
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
1306
1309
if cf_iface_hash == getModuleHash iface
1307
1310
then return ([] , Just $ mkHiFileResult ms iface details runtime_deps (Just (core_file, fingerprintToBS core_hash)))
1308
1311
else do_regenerate (RecompBecause " Core file out of date (doesn't match iface hash)" )
1309
1312
| 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
+ ]
1310
1320
(_, _reason) -> do_regenerate _reason
1311
1321
1312
1322
-- | Find the runtime dependencies by looking at the annotations
0 commit comments