File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,15 @@ public function report(Exception $e)
41
41
}
42
42
43
43
$ this ->logger ->error ($ e ->getMessage (), $ context );
44
+
45
+ $ this ->addSentrySupport ($ e );
46
+ }
47
+
48
+ private function addSentrySupport (Exception $ e )
49
+ {
50
+ if (app ()->bound ('sentry ' ) && $ this ->shouldReport ($ e )) {
51
+ app ('sentry ' )->captureException ($ e );
52
+ }
44
53
}
45
54
46
55
private function registerShutdownFunction ()
Original file line number Diff line number Diff line change @@ -27,6 +27,19 @@ public function it_logs_an_error_for_all_occurred_application_notices_warnings_e
27
27
]));
28
28
}
29
29
30
+ /** @test */
31
+ public function it_supports_sentry ()
32
+ {
33
+ app ()->instance ('sentry ' , $ sentry = spy ());
34
+ $ exception = new Exception ('Test exception ' , 111 );
35
+
36
+ $ handler = app (ExceptionHandler::class);
37
+ $ handler ->setLogger (spy (LoggerInterface::class));
38
+ $ handler ->report ($ exception );
39
+
40
+ $ sentry ->shouldHaveReceived ('captureException ' , [$ exception ]);
41
+ }
42
+
30
43
/** @test */
31
44
public function it_supports_custom_runtime_exception_which_has_ability_to_set_optional_context ()
32
45
{
You can’t perform that action at this time.
0 commit comments