fix(portal): catch all errors when sending welcome email (#9776)

Why:

* We were previously only catching the `:rate_limited` error when
sending welcome emails. This update adds a catch-all case to gracefully
handle the error and alert us.

---------

Signed-off-by: Brian Manifold <bmanifold@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
This commit is contained in:
Brian Manifold
2025-07-03 14:41:12 -07:00
committed by GitHub
parent 94660cbb2c
commit 83e71f45b8

View File

@@ -4,6 +4,7 @@ defmodule Web.Actors.Show do
import Web.Clients.Components
alias Domain.{Auth, Tokens, Flows, Clients}
alias Domain.Actors
require Logger
def mount(%{"id" => id}, _session, socket) do
with {:ok, actor} <-
@@ -730,6 +731,23 @@ defmodule Web.Actors.Show do
)
{:noreply, socket}
{:error, reason} ->
Logger.error("Unknown error while sending welcome email",
account_id: socket.assigns.account.id,
subject_actor_id: socket.assigns.subject.actor.id,
identity_id: identity.id,
reason: inspect(reason)
)
socket =
socket
|> put_flash(
:error,
"Unknown error while sending welcome email. We're looking into it."
)
{:noreply, socket}
end
end