File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 3
3
4
4
namespace Rodri \SimpleRouter \Helpers ;
5
5
6
+ use Exception ;
6
7
use Rodri \SimpleRouter \Response ;
7
8
use RuntimeException ;
8
9
14
15
class ErrorHelper
15
16
{
16
17
/**
17
- * @param RuntimeException $runtimeException
18
+ * @param RuntimeException|Exception $exception
18
19
* @param bool $debugMode
19
20
* @return Response
20
21
*/
21
- public static function handle (RuntimeException $ runtimeException , bool $ debugMode = false ): Response
22
+ public static function handle (RuntimeException | Exception $ exception , bool $ debugMode = false ): Response
22
23
{
23
24
if ($ debugMode )
24
25
return new Response ([
25
26
'Mode ' => 'Debug ' ,
26
27
'error ' => 'ControllerMethodNotFoundException ' ,
27
- 'message ' => $ runtimeException ->getMessage (),
28
- 'line ' => $ runtimeException ->getLine (),
29
- 'file ' => $ runtimeException ->getFile (),
30
- 'trace ' => $ runtimeException ->getTrace ()
28
+ 'message ' => $ exception ->getMessage (),
29
+ 'line ' => $ exception ->getLine (),
30
+ 'file ' => $ exception ->getFile (),
31
+ 'trace ' => $ exception ->getTrace ()
31
32
], StatusCode::INTERNAL_SERVER_ERROR );
32
33
33
34
return new Response (Response::INVALID_RESPONSE , StatusCode::INTERNAL_SERVER_ERROR );
You can’t perform that action at this time.
0 commit comments