Middleware to show better 4xx, 5xx responses #62

Open
wants to merge 3 commits into
from

Conversation

Projects
None yet
2 participants

potomak commented Apr 4, 2013

No description provided.

Owner

knutin commented Apr 4, 2013

I'm a bit reluctant to a catch-all in the middleware, as this makes it tricky to call the handle_event/3 callbacks for request_{exception,error,exit}. An option would be to call it from the middleware explicitly.

I will have to think about it for a bit.. :-)

@potomak potomak Add call to handle_event/3 request_* from inside middleware's handle/2
This is the easiest and maybe the worst solution but it solves the problem
of missing calls to handle_event/3 request_{throw,error,exit}.
5d05921

potomak commented Apr 4, 2013

While you were thinking I've tried to solve the problem in the easiest way 😁

Notes:

  • this pull request solves the problem of missing postprocess call for error requests (was it a problem to solve?)
  • the way I've tested handle_event/3 callback is primitive, I'd really like to see how you would achieve this task
  • this solution highlights problems of handling middlewares with a plain elli handler, it's elegant, but there should be a better way to do it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment