From 6894969302906700c282cfcc089906f5c6c57fa9 Mon Sep 17 00:00:00 2001 From: Gonzalo <456459+grzuy@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:43:19 -0300 Subject: [PATCH] fix: properly format throw value --- lib/tower_sentry/sentry/event.ex | 4 ++-- test/tower_sentry_test.exs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tower_sentry/sentry/event.ex b/lib/tower_sentry/sentry/event.ex index 386f40f..5e8e41d 100644 --- a/lib/tower_sentry/sentry/event.ex +++ b/lib/tower_sentry/sentry/event.ex @@ -22,7 +22,7 @@ defmodule TowerSentry.Sentry.Event do def from_tower_event(%Tower.Event{ kind: :throw, - reason: reason, + reason: value, stacktrace: stacktrace, id: id, plug_conn: plug_conn, @@ -31,7 +31,7 @@ defmodule TowerSentry.Sentry.Event do put_environment_name() Sentry.Event.create_event( - message: "(throw) #{reason}", + message: "(throw) #{inspect(value)}", stacktrace: stacktrace, level: :error, request: request_data(plug_conn), diff --git a/test/tower_sentry_test.exs b/test/tower_sentry_test.exs index fb158ac..8f091a1 100644 --- a/test/tower_sentry_test.exs +++ b/test/tower_sentry_test.exs @@ -85,7 +85,7 @@ defmodule TowerSentryTest do "environment" => "test", "exception" => [], "message" => %{ - "formatted" => "(throw) something" + "formatted" => "(throw) \"something\"" }, "threads" => [%{"stacktrace" => %{"frames" => frames}}] } @@ -239,7 +239,7 @@ defmodule TowerSentryTest do "environment" => "test", "exception" => [], "message" => %{ - "formatted" => "(throw) from inside a plug" + "formatted" => "(throw) \"from inside a plug\"" }, "threads" => [%{"stacktrace" => %{"frames" => frames}}], "request" => %{