File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -110,4 +110,32 @@ defmodule Sentry.LoggerTest do
110110 end
111111 :error_logger . delete_report_handler ( Sentry.Logger )
112112 end
113+
114+ test "error_logger passes context properly" do
115+ bypass = Bypass . open
116+ pid = self ( )
117+ Bypass . expect bypass , fn conn ->
118+ { :ok , body , conn } = Plug.Conn . read_body ( conn )
119+ body = Poison . decode! ( body )
120+ assert get_in ( body , [ "extra" , "fruit" ] ) == "apples"
121+ assert conn . request_path == "/api/1/store/"
122+ assert conn . method == "POST"
123+ send ( pid , "API called" )
124+ Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
125+ end
126+
127+ modify_env ( :sentry , dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
128+ :error_logger . add_report_handler ( Sentry.Logger )
129+
130+ capture_log fn ->
131+ Task . start ( fn ->
132+ Sentry.Context . set_extra_context ( % { fruit: "apples" } )
133+ raise "Unique Error"
134+ end )
135+
136+ assert_receive "API called"
137+ end
138+
139+ :error_logger . delete_report_handler ( Sentry.Logger )
140+ end
113141end
You can’t perform that action at this time.
0 commit comments