From b5ae6d7b11da63bdfcc8406f69855e131f2e8581 Mon Sep 17 00:00:00 2001 From: Joaquin Correa Date: Tue, 13 Aug 2024 17:00:23 -0300 Subject: [PATCH] fix error info key generation --- lib/boom_notifier/error_info.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/boom_notifier/error_info.ex b/lib/boom_notifier/error_info.ex index 24f1245..e48f26c 100644 --- a/lib/boom_notifier/error_info.ex +++ b/lib/boom_notifier/error_info.ex @@ -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