on master help sign in
Modify error messages for bad build artifacts to wrap more nicely on the terminal
00dfb69Evan Czaplicki
compiler/InterfaceSerialization.hs+9−8
@@ -33,11 +33,10 @@ interfaceDecode filePath bytes = do
33 Right (_, _, binaryInfo) -> Right binaryInfo
33 Right (_, _, binaryInfo) -> Right binaryInfo
34
34
35 Left (_, offset, err) ->
35 Left (_, offset, err) ->
36− Left $ concat [ "Got an error, '" ++ err ++ "' at offset "
36+ Left $ concat [ "Error reading build artifact: ", filePath, "\n"
37− , show offset ++ " of " ++ filePath ++ ".\n\n"
37+ , " The exact error was '", err, "' at offset ", show offset, ".\n"
38− , "This error may be due to an outdated or corrupt "
38+ , " The file was generated by a previous build and may be outdated or corrupt.\n"
39− , "artifact from a previous build. Please rebuild "
40− , filePath ++ " and try again."
39+ , " Please remove the file and try again."
41 ]
40 ]
42
41
43validVersion :: FilePath -> (String, ModuleInterface) ->
42validVersion :: FilePath -> (String, ModuleInterface) ->
@@ -46,6 +45,8 @@ validVersion filePath (name, interface) =
46 if iVersion interface == showVersion version then
45 if iVersion interface == showVersion version then
47 Right (name, interface)
46 Right (name, interface)
48 else
47 else
49− Left $ "Found build artifacts created by a different " ++
48+ Left $ concat
50− "Elm compiler version. Please rebuild " ++
49+ [ "Error reading build artifact: ", filePath, "\n"
50+ , " It was generated by a different version of the compiler: ", iVersion interface, "\n"
51− filePath ++ " and try again."
51+ , " Please remove the file and try again.\n"
52+ ]