Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
TwigExceptionHandler | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 1 |
withHtml | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | namespace BO\Zmsadmin\Helper; |
4 | |
5 | use Psr\Http\Message\RequestInterface; |
6 | use Psr\Http\Message\ResponseInterface; |
7 | |
8 | class TwigExceptionHandler extends \BO\Slim\TwigExceptionHandler |
9 | { |
10 | public static function withHtml( |
11 | RequestInterface $request, |
12 | ResponseInterface $response, |
13 | \Throwable $exception, |
14 | $status = 500 |
15 | ) { |
16 | if ($exception instanceof \Slim\Exception\HttpNotFoundException) { |
17 | \BO\Slim\Controller::prepareRequest($request); |
18 | return \BO\Slim\Render::withHtml($response, 'page/404.twig'); |
19 | } |
20 | try { |
21 | $workstation = \App::$http->readGetResult('/workstation/')->getEntity(); |
22 | $data = []; |
23 | if (isset($exception->data)) { |
24 | $data = $exception->data; |
25 | } |
26 | $exception->templatedata = array('workstation' => $workstation, 'sourceData' => $data); |
27 | } catch (\Throwable $workstationexception) { |
28 | // ignore |
29 | } |
30 | return parent::withHtml($request, $response, $exception, $status); |
31 | } |
32 | } |