Skip to content
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

Raise on invalid :json_decoder opt (Plug.Parsers) #775

Merged
merged 2 commits into from
Oct 5, 2018
Merged

Raise on invalid :json_decoder opt (Plug.Parsers) #775

merged 2 commits into from
Oct 5, 2018

Conversation

fertapric
Copy link
Contributor

Fixes #770

@josevalim
Copy link
Member

I am afraid all of those checks will slow down processing, especially the ensure_loaded?one, which is a bottleneck in earlier Erlang/OTP versions. So my suggestion is to, when we convert to a decode error, for us to not raise it in certain situations, such as UndefinedFunctionError.

@fertapric
Copy link
Contributor Author

@josevalim I thought that, in most cases, this init/1 function will be called at compile time, right here (unless init_mode: :runtime was used, but I think that’s only recommended for development). That’s why I didn’t mind to provide a richer error reporting 🙂

However, I wonder if I should have used Code.ensure_compiled/1 then.

@josevalim
Copy link
Member

Oh, I see. This is happening on init. So yeah, it looks good to me, but we do have to use ensure_compiled instead.

@josevalim josevalim merged commit ce38673 into elixir-plug:master Oct 5, 2018
@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants