You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One would typically want to handle a multi in the following pattern:
{existing multi}
|> Ecto.Multi.merge(fn %{job: job} = multi ->
Ecto.Multi.new()
|> __MODULE__.requeue("requeue_job", job)
end)
|> MyApp.Repo.transaction()
|> case do
{:error, :non_failed_job} -> do_something
end
The above would also allow you to pass the error on to fallback controllers and such.
However, the way the requeue function is currently implimented, it does not just register an error on the multi, but rather returns an error. This forces one do add a non-elegant error handling block somewhere midstream something like the following.
|> Ecto.Multi.merge(fn %{job: job} = multi ->
Ecto.Multi.new()
|> __MODULE__.requeue("requeue_job", job)
|> case do
{:error, :non_failed_job} ->
Ecto.Multi.new()
|> Ecto.Multi.error("requeue_job", {:error, :non_failed_job})
any ->
any
end
end)
|> MyApp.Repo.transaction()
|> case do
{:error, :non_failed_job} -> do_something
end
The text was updated successfully, but these errors were encountered:
One would typically want to handle a multi in the following pattern:
The above would also allow you to pass the error on to fallback controllers and such.
However, the way the requeue function is currently implimented, it does not just register an error on the multi, but rather returns an error. This forces one do add a non-elegant error handling block somewhere midstream something like the following.
The text was updated successfully, but these errors were encountered: