elixir-plug / plug_cowboy

Plug adapter for the Cowboy web server
Other
243 stars 48 forks source link

Logging non-500 exceptions #67

Closed arkgil closed 3 years ago

arkgil commented 3 years ago

Currently Plug.Cowboy.Translator only logs exceptions that were raised in the Plug pipeline only if the Plug.Exception.status/1 for the error returns a status code greater than or equal to 500:

https://github.com/elixir-plug/plug_cowboy/blob/8aa34d853a13d275eaa0806f00301d0ccbbbb0a7/lib/plug/cowboy/translator.ex#L31-L33

Would you be open for making this behaviour configurable? My thinking is that while implementing Plug.Exception is a great way to customize status codes (and in case of Phoenix, rendered responses), it's not always desirable to swallow the exception completely.

josevalim commented 3 years ago

We can make it customizable, yes. Probably need to use the app environment, PRs are welcome!