-
-
Notifications
You must be signed in to change notification settings - Fork 412
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
Content-type aware errors #353
Comments
Would you give an example? |
@GarrettMosier maybe this issue was an example: #296 |
I've seen this problem last week. It was easily solved with a middleware. but yes, I would be happy to have servant do that for me instead. My idea was to allow for a custom error type with custom instances for A different server monad and an That's as far as I got with this. I'm writing it down just because it might trigger a good idea. (-: |
This works for user-thrown errors, but I don't see how it would work for combinator-thrown errors. For now I'd be happy with the simpler option of having a fixed datatype. |
We've run into this problem and fixed it / worked around it downstream in a fairly elegant way. There are also some suggestions in the comments on how this design could be improved. Credit for the elegance all goes to the core servant design that allows you to replace basically any part of the engine with something you can build from scratch. I still think that's very cool! |
Combinators should return
ServantErr
s that match theAccept
header when possible. I'd think we can make a datatype for the error, and have theConfig
contain functions from the datatype and content-type toServantErr
, so e.g. HTML 404 pages are customizable.The text was updated successfully, but these errors were encountered: