From 37ea526c61322d3f816757b5c17972300317347b Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 13 Feb 2026 13:53:50 -0600 Subject: [PATCH] fix: log swallowed errors in integration connection test the catch-all error handler was silently discarding the error reason, making it impossible to debug failures. add logging and a specific handler for graphql validation errors. --- lib/towerops_web/live/org/integrations_live.ex | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/towerops_web/live/org/integrations_live.ex b/lib/towerops_web/live/org/integrations_live.ex index 320b23bb..9bbaae66 100644 --- a/lib/towerops_web/live/org/integrations_live.ex +++ b/lib/towerops_web/live/org/integrations_live.ex @@ -7,6 +7,8 @@ defmodule ToweropsWeb.Org.IntegrationsLive do alias Towerops.Integrations.Integration alias Towerops.Preseem.Client, as: PreseemClient + require Logger + @providers [ %{ id: "preseem", @@ -209,7 +211,12 @@ defmodule ToweropsWeb.Org.IntegrationsLive do defp format_connection_result({:error, %{reason: :nxdomain}}), do: {:error, "DNS lookup failed - check API endpoint"} + defp format_connection_result({:error, {:graphql_errors, errors}}), + do: {:error, "API query failed: #{inspect(Enum.map(errors, & &1["message"]))}"} + # Never expose internal error details to users - defp format_connection_result({:error, _reason}), - do: {:error, "Connection failed - please check your API credentials and try again"} + defp format_connection_result({:error, reason}) do + Logger.warning("Integration connection test failed: #{inspect(reason)}") + {:error, "Connection failed - please check your API credentials and try again"} + end end