@@ -25,22 +25,30 @@ class TestCommand extends Command
2525
2626 public function handle (ExceptionNotifyManager $ exceptionNotifyManager ): void
2727 {
28- $ this ->output ->section ('The main configuration is as follows: ' );
28+ $ this ->output ->note ('Test for exception-notify start. ' );
29+ $ this ->output ->section ('The main configuration is as follows. ' );
2930 $ this ->output ->listing ($ this ->getMainConfigurations ());
3031
31- $ runtimeException = new RuntimeException (<<<'note'
32- Test for exception-notify done.
33- Please check whether your channels received the exception notification report.
34- If not, please find reason in the default log.
35- note);
36- if ($ exceptionNotifyManager ->shouldReport ($ runtimeException )) {
37- throw $ runtimeException ;
38- }
32+ try {
33+ $ runtimeException = new RuntimeException ('Test for exception-notify. ' );
34+ if ($ exceptionNotifyManager ->shouldReport ($ runtimeException )) {
35+ throw $ runtimeException ;
36+ }
37+
38+ $ warning = sprintf (
39+ 'The exception [%s] should not be reported. Please check the configuration. ' ,
40+ \get_class ($ runtimeException )
41+ );
42+ } finally {
43+ $ this ->output ->warning (
44+ $ warning ?? <<<'warning'
45+ Please check whether your channels received the exception notification report.
46+ If not, please find reason in the default log.
47+ warning
48+ );
3949
40- $ this ->output ->warning (sprintf (
41- 'The exception [%s] should not be reported. Please check the configuration. ' ,
42- \get_class ($ runtimeException )
43- ));
50+ $ this ->output ->note ('Test for exception-notify done. ' );
51+ }
4452 }
4553
4654 private function getMainConfigurations (): array
0 commit comments