elli icon indicating copy to clipboard operation
elli copied to clipboard

Middleware to show better 4xx, 5xx responses

Open potomak opened this issue 12 years ago • 2 comments

potomak avatar Apr 04 '13 13:04 potomak

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.. :-)

knutin avatar Apr 04 '13 13:04 knutin

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

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

potomak avatar Apr 04 '13 23:04 potomak