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

Validate command dispatch registration in router #59

Closed
slashdotdash opened this issue Jun 9, 2017 · 1 comment
Closed

Validate command dispatch registration in router #59

slashdotdash opened this issue Jun 9, 2017 · 1 comment

Comments

@slashdotdash
Copy link
Member

slashdotdash commented Jun 9, 2017

When using the Commanded.Commands.Router to configure command dispatch, it would be helpful to validate that the command, handler, and aggregate modules exist.

In the following example, if the two module alias statements are forgotten then command dispatch will fail (UndefinedFunctionError module is not available).

defmodule MyApp.BankRouter do
  use Commanded.Commands.Router

  alias MyApp.OpenAccount
  alias MyApp.BankAccount

  dispatch OpenAccount, to: BankAccount, identity: :account_number
end

Instead, this should cause a compilation failure, prompting the user that the modules cannot be found.

@astery
Copy link
Contributor

astery commented Jun 11, 2017

Definitely, stumbled on that several times.

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

No branches or pull requests

2 participants