Skip to content

Commit

Permalink
fix: Log an error but don't fail when we can't parse an alert cause
Browse files Browse the repository at this point in the history
  • Loading branch information
Whoops committed May 15, 2024
1 parent 8963d8b commit 4a5bea2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/parse/lib/parse/alerts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ defmodule Parse.Alerts do
the basic field set.
"""

require Logger
use Timex

alias Model.Alert
Expand Down Expand Up @@ -75,6 +76,11 @@ defmodule Parse.Alerts do
copy(cause)
end

defp cause(alert) do
Logger.error("No cause found in alert: #{inspect(alert)}")
""
end

def lifecycle("ONGOING"), do: "ONGOING"
def lifecycle("UPCOMING"), do: "UPCOMING"
def lifecycle(<<"UPCOMING", _::binary-1, "ONGOING">>), do: "ONGOING_UPCOMING"
Expand Down

0 comments on commit 4a5bea2

Please sign in to comment.