HotFix: Error repaired

This commit is contained in:
JoseluCross
2018-10-26 17:19:17 +02:00
parent f3401a900d
commit a4ff90636f

View File

@@ -278,7 +278,7 @@ function HTTPError($code){
return array("text"=>$text,"number"=>$code); return array("text"=>$text,"number"=>$code);
} }
$app->error(function (\Exception $e,$request, $code = 500) use ($app) { $app->error(function (\Exception $e,$request) use ($app) {
$user = null; $user = null;
try{ try{
$user = getUser($app); $user = getUser($app);
@@ -288,15 +288,17 @@ $app->error(function (\Exception $e,$request, $code = 500) use ($app) {
if ($app['debug']) { if ($app['debug']) {
return; return;
}else { }else {
$code=500;
if($e instanceof \Symfony\Component\HttpKernel\Exception\HttpException)
$error = HTTPError($e->getStatusCode());
$error = HTTPError($code);
}
return $app['twig']->render($app['fronthtml'].'/error.twig', Array( return $app['twig']->render($app['fronthtml'].'/error.twig', Array(
'page' => array("title"=>$code), 'page' => array("title"=>$code),
'error' => $error, 'error' => $error,
'user' => $user, 'user' => $user,
)); ));
}
}); });