aviagarwal1212

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

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

aviagarwal1212

Will do.

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 48475 226
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
Qqwy
Update: How to use the Blogs &amp; Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127536 1222
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New

We're in Beta

About us Mission Statement