on master help sign in
report decoding errors explicitly from File.readBinary
commit970bb554a31280abb4b4de9cd2e6321ef7fa6722 authorEvan Czaplicki <evancz@users.noreply.github.com> dateWed 10 Jul 2019, 15:58 (7 years ago) parent820e5f8
1 file changed+14−2
builder/src/File.hs+14−2
builder/src/File.hs+14−2
@@ -78,8 +78,20 @@ readBinary path =
7878 then
7979 do result <- Binary.decodeFileOrFail path
8080 case result of
81− Right a -> return (Just a)
82− Left _ -> return Nothing
81+ Right a ->
82+ return (Just a)
83+
84+ Left (offset, message) ->
85+ do IO.hPutStrLn IO.stderr $ unlines $
86+ [ "+-------------------------------------------------------------------------------"
87+ , "| Corrupt File: " ++ path
88+ , "| Byte Offset: " ++ show offset
89+ , "| Message: " ++ message
90+ , "| Please report this to https://github.com/elm/compiler/issues"
91+ , "| Trying to continue anyway."
92+ , "+-------------------------------------------------------------------------------"
93+ ]
94+ return Nothing
8395 else
8496 return Nothing
8597