Repository navigation
Conversation
f346371 to
bdec0dd
Compare
| hClose h0 | ||
|
|
||
| -- readFile must close the handle on exception | ||
| let checkReadFile rf = do |
There was a problem hiding this comment.
Could you please add a type signature for checkReadFile?
| Left e | Just ioe <- E.fromException e -> E.throwIO (augmentIOError ioe "hGetContents" h) | ||
| Left e -> E.throwIO | ||
| #if __GLASGOW_HASKELL__ >= 912 | ||
| (E.NoBacktrace e) |
There was a problem hiding this comment.
Why do we want no backtrace? (I'm rather illiterate when it comes to exceptions)
There was a problem hiding this comment.
So we are rethrowing e :: SomeException, which already contains a backtrace. NoBacktrace tells throw not to add yet another backtrace on top.
This logic originates from System.IO.hGetContents' so I don't have all the rationale in mind. Notably I'm also curious why the first branch doesn't have NoBacktrace. Perhaps that's to remember where the extra data from augmentIOError comes from.
Another detail that makes investigating this difficult is there is a bug in 9.14 where throwIO discards any existing trace so I got no trace at all in the end. This has already been fixed upstream. So I'm planning to wait for the next GHC to have another look at how exceptions work.
bdec0dd to
e36b4c3
Compare
e36b4c3 to
7f0f8d5
Compare
Close #712