1 | <?php |
||
20 | class ExceptionRouter implements MiddlewareInterface |
||
21 | { |
||
22 | /** |
||
23 | * The logger. |
||
24 | * |
||
25 | * @var LoggerInterface |
||
26 | */ |
||
27 | private $log; |
||
28 | |||
29 | /** |
||
30 | * The controller that will display 500 errors. |
||
31 | * |
||
32 | * @var Http500HandlerInterface |
||
33 | */ |
||
34 | private $errorController; |
||
35 | |||
36 | /** |
||
37 | * @Important |
||
38 | * |
||
39 | * @param Http500HandlerInterface $errorController The controller in charge of displaying the HTTP 500 error. |
||
40 | * @param LoggerInterface $log Logger to log errors. |
||
41 | */ |
||
42 | public function __construct(Http500HandlerInterface $errorController, LoggerInterface $log = null) |
||
47 | |||
48 | /** |
||
49 | * Actually handle the exception. |
||
50 | * |
||
51 | * @param \Throwable $t |
||
52 | * @param Request $request |
||
53 | * @return ResponseInterface |
||
54 | */ |
||
55 | private function handleException(\Throwable $t, Request $request) |
||
74 | |||
75 | /** |
||
76 | * Process an incoming server request and return a response, optionally delegating |
||
77 | * to the next middleware component to create the response. |
||
78 | * |
||
79 | * @param Request $request |
||
80 | * @param DelegateInterface $delegate |
||
81 | * |
||
82 | * @return Response |
||
83 | */ |
||
84 | public function process(Request $request, DelegateInterface $delegate) |
||
92 | } |
||
93 |