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);
}
$app->error(function (\Exception $e,$request, $code = 500) use ($app) {
$app->error(function (\Exception $e,$request) use ($app) {
$user = null;
try{
$user = getUser($app);
@@ -287,16 +287,18 @@ $app->error(function (\Exception $e,$request, $code = 500) use ($app) {
}
if ($app['debug']) {
return;
}else{
$error = HTTPError($code);
return $app['twig']->render($app['fronthtml'].'/error.twig', Array(
'page' => array("title"=>$code),
'error' => $error,
'user' => $user,
));
}else {
$code=500;
if($e instanceof \Symfony\Component\HttpKernel\Exception\HttpException)
$error = HTTPError($e->getStatusCode());
}
return $app['twig']->render($app['fronthtml'].'/error.twig', Array(
'page' => array("title"=>$code),
'error' => $error,
'user' => $user,
));
});