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) ->
|
||||
parse_tabular(body)
|
||||
|
||||
{:ok, %{status: status, body: body}} ->
|
||||
{:error, "GIRO HTTP #{status}: #{inspect(body)}"}
|
||||
{:ok, %{status: 404}} ->
|
||||
{:error, :giro_api_unavailable}
|
||||
|
||||
{:ok, %{status: status}} ->
|
||||
{:error, "GIRO HTTP #{status}"}
|
||||
|
||||
{:error, reason} ->
|
||||
{:error, "GIRO request failed: #{inspect(reason)}"}
|
||||
|
|
|
|||
|
|
@ -74,5 +74,6 @@ defmodule Microwaveprop.Workers.IonosphereFetchWorker do
|
|||
end
|
||||
|
||||
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)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue