on master help sign in
report decoding errors explicitly from File.readBinary
970bb55Evan Czaplicki
builder/src/File.hs+14−2
@@ -78,8 +78,20 @@ readBinary path =
78 then
78 then
79 do result <- Binary.decodeFileOrFail path
79 do result <- Binary.decodeFileOrFail path
80 case result of
80 case result of
81+ Right a ->
81− Right a -> return (Just 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+ ]
82− Left _ -> return Nothing
94+ return Nothing
83 else
95 else
84 return Nothing
96 return Nothing
85
97