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)
4141 }
4242
4343 $ 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+ }
4453 }
4554
4655 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
2727 ]));
2828 }
2929
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+
3043 /** @test */
3144 public function it_supports_custom_runtime_exception_which_has_ability_to_set_optional_context ()
3245 {
You can’t perform that action at this time.
0 commit comments