From 611368eb780d9a2d5d0476cd9e00da2f0b69a647 Mon Sep 17 00:00:00 2001 From: alexwl Date: Sat, 3 Aug 2019 19:59:18 +0300 Subject: Fail immediately when a GHC mismatch is detected. Closes #40. --- src/HaskellCodeExplorer/PackageInfo.hs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/HaskellCodeExplorer/PackageInfo.hs b/src/HaskellCodeExplorer/PackageInfo.hs index 07f974e..dbfbfc7 100644 --- a/src/HaskellCodeExplorer/PackageInfo.hs +++ b/src/HaskellCodeExplorer/PackageInfo.hs @@ -153,16 +153,14 @@ createPackageInfo packageDirectoryPath mbDistDirRelativePath sourceCodePreproces let currentPackageId = HCE.PackageId (T.pack packageName) packageVersion unless (take 3 (versionBranch packageCompilerVersion) == - take 3 (versionBranch ghcVersion)) $ - logInfoN $ - T.concat - [ "GHC version mismatch. haskell-code-indexer: " - , T.pack $ showVersion ghcVersion - , ", package: " - , T.pack $ showVersion packageCompilerVersion - , ". " - , "The indexing might fail." - ] + take 3 (versionBranch ghcVersion)) $ do + logErrorN $ T.concat + [ "GHC version mismatch. haskell-code-indexer: " + , T.pack $ showVersion ghcVersion + , ", package: " + , T.pack $ showVersion packageCompilerVersion + ] + liftIO exitFailure logInfoN $ T.append "Indexing " $ HCE.packageIdToText currentPackageId let buildComponents = L.map -- cgit v1.2.3