-
Notifications
You must be signed in to change notification settings - Fork 38
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
Error handling #39
Comments
At my company we have a specific format for error bodies. Currently I'm catching at exceptions and thrown values in the callback and returning said body. Is this the recommended way to do this? :) |
I would suggest to use postprocess(Req, {500, Body}, Config) ->
custom_error(Req, [], Config);
postprocess(Req, {500, Headers, Body}, Config) ->
custom_error(Req, Headers, Config);
postprocess(_, Res, _) ->
Res.
custom_error(Req, Headers, Config) ->
{500, Headers, CustomBody}. |
Wonderful, thank you. I see that |
Yeah! I'd love to codify an |
That would be great. It's quite unclear how to use the middlewear features at the moment I think. |
This seems pretty related to elli-lib/elli_fileserve#7 and #3. Also note that I've spec'd out |
That's much clearer for me, thanks :) |
Great! I’ll publish a new release in the next few days. |
https://hex.pm/packages/elli/2.1.2 Feel free to re-open if need be, but I'm closing this for now. |
Hello!
Is there a recommended way of handling errors so that an application using Elli serves 500 with a suitable body whenever the handler crashes?
Thanks,
Louis
The text was updated successfully, but these errors were encountered: