Improve handle decoding error messages
When handle decoding encounters a byte sequence it cannot handle and ErrorOnCodingFailure
is set, at the moment an IO error with a pretty non-descriptive messages is thrown (invalid byte sequence
).
The user should get a bit more Information in that case:
-
What was the byte sequence that caused the error (and if possible where in the input, of course hard with handles)
-
A stack trace of the functions that caused this (probably from
hGetContents
and similar upwards)
It’s a very hard-to-debug error with the current implementation.