Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Exception wrapping stream to catch attoparsec errors #4

Open
afcowie opened this Issue Jan 21, 2013 · 1 comment

Comments

Projects
None yet
2 participants
Owner

afcowie commented Jan 21, 2013

In a comment on snapframework/io-streams#3 (comment), @gregorycollins wrote:

Attoparsec has limited
error reporting support. One thing you could do is write an exception
wrapping stream that would catch any exception generated by read and wrap
some kind of informative error message around it. More practically, what
you will want to do for http-streams is to catch the exceptions you expect
(ParseException being chief amongst them) and then do something smart about
converting that error into a sensible http-streams exception.

This would be a Good Thing™.

AfC

@ghost ghost assigned afcowie Jan 21, 2013

Contributor

gregorycollins commented Jan 21, 2013

I meant that in your downstream code, if you receive an io-streams ParseException, that means you know where it came from and can re-wrap that to provide a useful error message to the user (BadHttpResponse or whatever).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment