Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception wrapping stream to catch attoparsec errors #4

Open
istathar opened this issue Jan 21, 2013 · 1 comment
Open

Exception wrapping stream to catch attoparsec errors #4

istathar opened this issue Jan 21, 2013 · 1 comment

Comments

@istathar
Copy link
Member

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 istathar Jan 21, 2013
@gregorycollins
Copy link
Contributor

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
Projects
None yet
Development

No branches or pull requests

2 participants