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

improving error message when invalid mailer configuration #148

Merged
merged 1 commit into from
May 3, 2016

Conversation

martinos
Copy link
Contributor

@martinos martinos commented May 2, 2016

If we don't configure properly the mailer, there is a compiler error that does not give much information.
See issue: #149

= Compilation error on file lib/mailer.ex ==
** (Protocol.UndefinedError) protocol Enumerable not implemented for nil
    (elixir) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir) lib/enum.ex:116: Enumerable.reduce/3
    (elixir) lib/enum.ex:1486: Enum.reduce/3
    lib/bamboo/mailer.ex:187: Bamboo.Mailer.parse_opts/2
    lib/mailer.ex:2: (module)
    (stdlib) erl_eval.erl:669: :erl_eval.do_apply/6
    (elixir) lib/kernel/parallel_compiler.ex:100: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/8

By doing the change in this pull request we get a better error message:

== Compilation error on file lib/mailer.ex ==
** (ArgumentError) application :basic_guardian is not loaded, or the configuration parameter BasicGuardian.Mailer is not set
    (elixir) lib/application.ex:203: Application.fetch_env!/2
    lib/bamboo/mailer.ex:187: Bamboo.Mailer.parse_opts/2
    lib/mailer.ex:2: (module)
    (stdlib) erl_eval.erl:669: :erl_eval.do_apply/6
    (elixir) lib/kernel/parallel_compiler.ex:100: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/8

@paulcsmith
Copy link
Contributor

@martinos This is a great catch! Friendly error messages make things a lot nicer for people getting started. Can you rebase this branch and then I'll merge it in.

@martinos
Copy link
Contributor Author

martinos commented May 3, 2016

Done. Thanks

@paulcsmith paulcsmith merged commit 70176a3 into beam-community:master May 3, 2016
@paulcsmith
Copy link
Contributor

Perfect. Thank you so much!

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