File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -397,4 +397,26 @@ defmodule Sentry.LoggerBackendTest do
397397 assert_receive ( "API called" )
398398 end )
399399 end
400+
401+ test "handles malformed :callers metadata" do
402+ Logger . configure_backend ( Sentry.LoggerBackend , capture_log_messages: true )
403+ bypass = Bypass . open ( )
404+ modify_env ( :sentry , dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
405+ pid = self ( )
406+ { :ok , dead_pid } = Task . start ( fn -> nil end )
407+
408+ Bypass . expect_once ( bypass , fn conn ->
409+ { :ok , body , conn } = Plug.Conn . read_body ( conn )
410+ json = Jason . decode! ( body )
411+ assert json [ "message" ] == "error"
412+ send ( pid , "API called" )
413+ Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
414+ end )
415+
416+ capture_log ( fn ->
417+ Logger . error ( "error" , callers: [ dead_pid , nil ] )
418+
419+ assert_receive ( "API called" )
420+ end )
421+ end
400422end
You can’t perform that action at this time.
0 commit comments