Skip to content

Commit f229831

Browse files
committed
add error message when binary decoding fails
1 parent a324d58 commit f229831

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

builder/src/File.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,13 @@ readBinary path =
8282
return (Just a)
8383

8484
Left (offset, message) ->
85-
do IO.hPutStrLn IO.stderr $ unlines $
85+
do Dir.copyFile path "bad.dat"
86+
IO.hPutStrLn IO.stderr $ unlines $
8687
[ "+-------------------------------------------------------------------------------"
87-
, "| Corrupt File: " ++ path
88-
, "| Byte Offset: " ++ show offset
89-
, "| Message: " ++ message
88+
, "| Corrupt File: " ++ path
89+
, "| Byte Offset: " ++ show offset
90+
, "| Message: " ++ message
91+
, "|"
9092
, "| Please report this to https://github.com/elm/compiler/issues"
9193
, "| Trying to continue anyway."
9294
, "+-------------------------------------------------------------------------------"

0 commit comments

Comments
 (0)