From 83e71f45b8f375cf95f89e5f3423f32fc3a37ac9 Mon Sep 17 00:00:00 2001 From: Brian Manifold Date: Thu, 3 Jul 2025 14:41:12 -0700 Subject: [PATCH] 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 Co-authored-by: Jamil --- elixir/apps/web/lib/web/live/actors/show.ex | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/elixir/apps/web/lib/web/live/actors/show.ex b/elixir/apps/web/lib/web/live/actors/show.ex index 0fc2f2b30..cd95340c2 100644 --- a/elixir/apps/web/lib/web/live/actors/show.ex +++ b/elixir/apps/web/lib/web/live/actors/show.ex @@ -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