on master help sign in
Merge pull request #3353 from jfdm/fix-error-message

Clarify ambiguous error message.

commit44539ec70a080aee213376c52efc2ed04cde40b5 authorNiklas Larsson <metaniklas@gmail.com> dateThu 11 Aug 2016, 21:24 (10 years ago) parentdcf6ec943027cc
1 file changed+16−3
src/Idris/IBC.hs+16−3
src/Idris/IBC.hs+16−3
@@ -362,9 +362,22 @@ process reexp phase archive fn = do
362362 when (ver /= ibcVersion) $ do
363363 logIBC 1 "ibc out of date"
364364 let e = if ver < ibcVersion
365− then " an earlier " else " a later "
366− ifail $ "Incompatible ibc version.\nThis library was built with"
367− ++ e ++ "version of Idris.\n" ++ "Please clean and rebuild."
365+ then "an earlier" else "a later"
366+ ldir <- runIO $ getIdrisLibDir
367+ let start = if ldir `L.isPrefixOf` fn
368+ then "This external module"
369+ else "This module"
370+ let end = case L.stripPrefix ldir fn of
371+ Nothing -> "Please clean and rebuild."
372+
373+ Just ploc -> unwords ["Please reinstall:", L.head $ splitDirectories ploc]
374+ ifail $ unlines [ unwords ["Incompatible ibc version for:", show fn]
375+ , unwords [start
376+ , "was built with"
377+ , e
378+ , "version of Idris."]
379+ , end
380+ ]
368381 source <- getEntry "" "sourcefile" archive
369382 srcok <- runIO $ doesFileExist source
370383 when srcok $ timestampOlder source fn