diff --git a/lib/sentry/event.ex b/lib/sentry/event.ex index f9253ef8..8f638627 100644 --- a/lib/sentry/event.ex +++ b/lib/sentry/event.ex @@ -150,6 +150,8 @@ defmodule Sentry.Event do type = if error_type == :error do normalized.__struct__ + |> to_string() + |> String.trim_leading("Elixir.") else error_type end diff --git a/test/event_test.exs b/test/event_test.exs index bd385ac7..db50f158 100644 --- a/test/event_test.exs +++ b/test/event_test.exs @@ -23,7 +23,7 @@ defmodule Sentry.EventTest do assert event.exception == [ %{ - type: UndefinedFunctionError, + type: "UndefinedFunctionError", value: "function Sentry.Event.not_a_function/3 is undefined or private", module: nil } diff --git a/test/logger_backend_test.exs b/test/logger_backend_test.exs index 99fd849d..4940f5a0 100644 --- a/test/logger_backend_test.exs +++ b/test/logger_backend_test.exs @@ -73,7 +73,7 @@ defmodule Sentry.LoggerBackendTest do Bypass.expect(bypass, fn conn -> {:ok, body, conn} = Plug.Conn.read_body(conn) json = Jason.decode!(body) - assert List.first(json["exception"])["type"] == "Elixir.ErlangError" + assert List.first(json["exception"])["type"] == "ErlangError" assert List.first(json["exception"])["value"] == "Erlang error: :bad_exit" assert conn.request_path == "/api/1/store/" assert conn.method == "POST" @@ -108,7 +108,7 @@ defmodule Sentry.LoggerBackendTest do "post_context" => [] } = List.last(json["stacktrace"]["frames"]) - assert List.first(json["exception"])["type"] == "Elixir.FunctionClauseError" + assert List.first(json["exception"])["type"] == "FunctionClauseError" assert conn.request_path == "/api/1/store/" assert conn.method == "POST" send(self_pid, "API called")