New debug option

This commit is contained in:
Pierre Rudloff 2019-11-27 21:22:23 +01:00
parent 89c1538d0f
commit 0b1ce90f47
4 changed files with 27 additions and 13 deletions

View file

@ -16,6 +16,7 @@ use Slim\Container;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Views\Smarty;
use Symfony\Component\Debug\ExceptionHandler;
/**
* Main controller.
@ -233,18 +234,23 @@ class FrontController extends BaseController
*/
public function error(Request $request, Response $response, Exception $exception)
{
$this->view->render(
$response,
'error.tpl',
[
'config' => $this->config,
'errors' => $exception->getMessage(),
'class' => 'video',
'title' => _('Error'),
'canonical' => $this->getCanonicalUrl($request),
'locale' => $this->localeManager->getLocale(),
]
);
if ($this->config->debug) {
$handler = new ExceptionHandler();
$handler->handle($exception);
} else {
$this->view->render(
$response,
'error.tpl',
[
'config' => $this->config,
'errors' => $exception->getMessage(),
'class' => 'video',
'title' => _('Error'),
'canonical' => $this->getCanonicalUrl($request),
'locale' => $this->localeManager->getLocale(),
]
);
}
return $response->withStatus(500);
}