mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 06:18:44 +02:00
N°4162 Portal exception page : restore exception message
Was removed with Silex to Symfony migration
This commit is contained in:
@@ -57,11 +57,17 @@ class ExceptionListener implements ContainerAwareInterface
|
||||
$oException = $oEvent->getException();
|
||||
|
||||
// Prepare / format exception data
|
||||
$sErrorMessage = $oException->getMessage();
|
||||
if ($oException instanceof \MySQLException) {
|
||||
// Those exceptions should be caught before (in the metamodel startup, before event starting Symfony !)
|
||||
// They could contain far too much info :/
|
||||
// So as an extra precaution we are filtering here anyway !
|
||||
$sErrorMessage = 'DB Server error, check error log !';
|
||||
} else {
|
||||
$sErrorMessage = $oException->getMessage();
|
||||
}
|
||||
// - For none HTTP exception, status code will be a generic 500
|
||||
$iStatusCode = ($oException instanceof HttpExceptionInterface) ? $oException->getStatusCode() : Response::HTTP_INTERNAL_SERVER_ERROR;
|
||||
switch ($iStatusCode)
|
||||
{
|
||||
switch ($iStatusCode) {
|
||||
case 404:
|
||||
$sErrorTitle = Dict::S('Error:HTTP:404');
|
||||
break;
|
||||
@@ -90,10 +96,10 @@ class ExceptionListener implements ContainerAwareInterface
|
||||
|
||||
// Prepare data for template
|
||||
$aData = array(
|
||||
'exception' => $oFlattenException,
|
||||
'code' => $iStatusCode,
|
||||
'error_title' => $sErrorTitle,
|
||||
'error_message' => '',
|
||||
'exception' => $oFlattenException,
|
||||
'code' => $iStatusCode,
|
||||
'error_title' => $sErrorTitle,
|
||||
'error_message' => $sErrorMessage,
|
||||
);
|
||||
|
||||
// Generate the response
|
||||
|
||||
Reference in New Issue
Block a user