aviagarwal1212
Unsure why Reactor step should succeed in tutorial
Hello all,
I have been dipping my toes in Reactor recently, but I am sort of stuck on the Error Handling with Compensation.
In Step 6,
# Test with a valid @example.com email (should succeed)
{:ok, user} = Reactor.run(ResilientUserRegistration, %{
email: "alice@example.com",
password: "secretpassword123"
})
In step 5, the tutorial defines a :send_admin_notification step that utilizes EmailService to simulate sending an email to “admin@company.com”. However, EmailService is set up to fail for any email address that doesn’t end with “@example.com”. Wouldn’t the Reactor eventually fail regardless of the entered email address? For reference, this is what I get when I run the step:
{:error,
%Reactor.Error.Invalid{
errors: [
%Reactor.Error.Invalid.RunStepError{
error: %{message: "Email service unavailable", type: :network_timeout},
step: %Reactor.Step{
arguments: [
%Reactor.Argument{
description: nil,
name: :user,
source: %Reactor.Template.Result{name: :create_user, sub_path: []},
transform: nil
},
%Reactor.Argument{
description: nil,
name: :email,
source: %Reactor.Template.Value{
value: "admin@company.com",
sub_path: []
},
transform: nil
}
],
async?: true,
context: %{},
description: nil,
impl: {EmailService, []},
name: :send_admin_notification,
max_retries: 1,
ref: :send_admin_notification,
transform: nil,
guards: []
},
splode: Reactor.Error,
bread_crumbs: [],
vars: [],
path: [],
stacktrace: #Splode.Stacktrace<>,
class: :invalid
}
],
splode: Reactor.Error,
bread_crumbs: [],
vars: [],
path: [],
stacktrace: #Splode.Stacktrace<>,
class: :unknown
}}
Thank you!
Marked As Solved
chgeuer
Your reasoning is correct. It should fail, because the admin_email isn’t on example.com, therefore it should fail, and the output from your invocation shows it did fail.
The error seems to be that the tutorial claims that “Test with a valid @example.com email (should succeed)”.
Also Liked
aviagarwal1212
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









