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