4 ms·
Whether or not this is a problem comes down to two factors: 1 - How ok are you with just accepting things as documenting, like having to put `use HelloWeb, :co
by latch 6y ago
Whether or not this is a problem comes down to two factors:
1 - How ok are you with just accepting things as documenting, like having to put `use HelloWeb, :controller` in each controller. Personally, I _had_ to understand what this was doing and how, but I imagine some people don't care so much.
2 - Do you need / want to do anything outside what's an idiomatic Phoenix. As a simple example, I think Plug.Parser is wrong to raise an exception when invalid json is given to it (shitty user data is hardly "exceptional" and I don't need error logs with poor signal to noise).
- ericmj 6y ago> As a simple example, I think Plug.Parser is wrong to raise an exception when invalid json is given to it (shitty user data is hardly "exceptional" and I don't need error logs with poor signal to noise). Plug sets the status code for parser errors to 400: https://github.com/elixir-plug/plug/blob/v1.10.4/lib/plug/parsers.ex#L38 https://github.com/elixir-plug/plug/blob/v1.10.4/lib/plug/pa... You should check the `:plug_status` field of the exception and only log/report the error if it's in the 5xx range.
- tonyarkles 6y agoRe: 1. I had the same concern, but the nice thing is that when you get to the point where you gotta know what’s happening, the file with the :controller code is right there in the auto-generated file in lib. You can just open it up and see! Re: 2, your entire plug chain is accessible and configurable if you don’t like the defaults. I’ve never tried to modify the specific behaviour you’re referring to, but my other experience with modifying plus behaviour has generally been pretty smooth.