Skip to content

Commit

Permalink
fix error info key generation
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinco committed Aug 13, 2024
1 parent e8c29f7 commit b5ae6d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/boom_notifier/error_info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ defmodule BoomNotifier.ErrorInfo do
|> :erlang.crc32()
end

def ensure_key(%__MODULE__{} = error_info) do
def ensure_key(%{key: nil} = error_info) do
error_info |> Map.put(:key, generate_error_key(error_info))
end

def ensure_key(%{} = error_info) do
error_info |> Map.put_new_lazy(:key, fn -> generate_error_key(error_info) end)
end
end

0 comments on commit b5ae6d7

Please sign in to comment.