-
Notifications
You must be signed in to change notification settings - Fork 41
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
Ensure Ecto projections works with Commanded's event handler error/3
callback
#10
Comments
Is there no current way to do error handling? |
@sardaukar It needs to be tested using the |
I tried returning an error tuple from The following arguments were given to Ecto.Repo.Queryable.transaction/4: # 1 Ecto.Adapters.Postgres # 2 Toby.Repo # 3 {:error, :reason} # 4 [timeout: :infinity, pool_timeout: :infinity] Attempted function clauses (showing 2 out of 2): def transaction(adapter, repo, fun, opts) when is_function(fun, 0) def transaction(adapter, repo, %Ecto.Multi{} = multi, opts) code: Projector.handle(task_assigned_evt, %{ stacktrace: (ecto) lib/ecto/repo/queryable.ex:15: Ecto.Repo.Queryable.transaction/4 (toby) lib/projections/ecto.ex:74: Toby.Projectors.Task.AssignedTasks.update_projection/3 test/toby/projectors/task/assigned_tasks_test.exs:17: (test) The test:
What am I doing wrong? |
If you're testing the alias Commanded.Event.FailureContext
assert {:error, error} = Projector.handle(task_assigned_evt, %{
event_number: last_seen_event_number + 1
})
assert :skip = Projector.error({:error, error}, task_assigned_evt, %FailureContext{}) |
I see. Thanks! |
Tried again - still get the same error. Is it because I'm calling |
I also notice the stacktrace mentions |
Thanks for supporting this! |
Defining an
error/3
callback in a projection, using Commanded's event handler (#133), and returning:skip
should ignore the problematic event and allow the projection to continue.The text was updated successfully, but these errors were encountered: