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

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement