fix: handle GIRO API 404 cleanly — don't dump raw HTML into logs
This commit is contained in:
parent
65df3f9242
commit
beed193605
2 changed files with 6 additions and 2 deletions
|
|
@ -58,8 +58,11 @@ defmodule Microwaveprop.Ionosphere.GiroClient do
|
||||||
{:ok, %{status: 200, body: body}} when is_binary(body) ->
|
{:ok, %{status: 200, body: body}} when is_binary(body) ->
|
||||||
parse_tabular(body)
|
parse_tabular(body)
|
||||||
|
|
||||||
{:ok, %{status: status, body: body}} ->
|
{:ok, %{status: 404}} ->
|
||||||
{:error, "GIRO HTTP #{status}: #{inspect(body)}"}
|
{:error, :giro_api_unavailable}
|
||||||
|
|
||||||
|
{:ok, %{status: status}} ->
|
||||||
|
{:error, "GIRO HTTP #{status}"}
|
||||||
|
|
||||||
{:error, reason} ->
|
{:error, reason} ->
|
||||||
{:error, "GIRO request failed: #{inspect(reason)}"}
|
{:error, "GIRO request failed: #{inspect(reason)}"}
|
||||||
|
|
|
||||||
|
|
@ -74,5 +74,6 @@ defmodule Microwaveprop.Workers.IonosphereFetchWorker do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp format_reason(reason) when is_binary(reason), do: reason
|
defp format_reason(reason) when is_binary(reason), do: reason
|
||||||
|
defp format_reason(:giro_api_unavailable), do: "GIRO API endpoint unavailable (404)"
|
||||||
defp format_reason(reason), do: inspect(reason, printable_limit: 200)
|
defp format_reason(reason), do: inspect(reason, printable_limit: 200)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue