Skip to content

Commit d69fc02

Browse files
committed
log errors in testclient
1 parent 1f4277b commit d69fc02

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

test/client_test.exs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ defmodule Sentry.ClientTest do
5050
test "errors when attempting to report invalid JSON" do
5151
modify_env(:sentry, dsn: "http://public:secret@localhost:3000/1")
5252
unencodable_tuple = {:a, :b, :c}
53-
assert :error = Sentry.capture_message(unencodable_tuple)
53+
54+
capture_log(fn ->
55+
assert :error = Sentry.capture_message(unencodable_tuple)
56+
end)
5457
end
5558

5659
test "calls anonymous before_send_event" do

test/support/test_client.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
defmodule Sentry.TestClient do
22
@behaviour Sentry.HTTPClient
3+
require Logger
34

45
def send_event(%Sentry.Event{} = event, _opts \\ []) do
56
{endpoint, _public_key, _secret_key} = Sentry.Client.get_dsn!
67
event = Sentry.Client.maybe_call_before_send_event(event)
78
case Poison.encode(event) do
89
{:ok, body} ->
910
Sentry.Client.request(:post, endpoint, [], body)
10-
{:error, _error} ->
11+
{:error, error} ->
12+
Logger.error("Error sending in Sentry.TestClient: #{inspect(error)}")
1113
:error
1214
end
1315
end

0 commit comments

Comments
 (0)