mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +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();
|
$oException = $oEvent->getException();
|
||||||
|
|
||||||
// Prepare / format exception data
|
// 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
|
// - For none HTTP exception, status code will be a generic 500
|
||||||
$iStatusCode = ($oException instanceof HttpExceptionInterface) ? $oException->getStatusCode() : Response::HTTP_INTERNAL_SERVER_ERROR;
|
$iStatusCode = ($oException instanceof HttpExceptionInterface) ? $oException->getStatusCode() : Response::HTTP_INTERNAL_SERVER_ERROR;
|
||||||
switch ($iStatusCode)
|
switch ($iStatusCode) {
|
||||||
{
|
|
||||||
case 404:
|
case 404:
|
||||||
$sErrorTitle = Dict::S('Error:HTTP:404');
|
$sErrorTitle = Dict::S('Error:HTTP:404');
|
||||||
break;
|
break;
|
||||||
@@ -90,10 +96,10 @@ class ExceptionListener implements ContainerAwareInterface
|
|||||||
|
|
||||||
// Prepare data for template
|
// Prepare data for template
|
||||||
$aData = array(
|
$aData = array(
|
||||||
'exception' => $oFlattenException,
|
'exception' => $oFlattenException,
|
||||||
'code' => $iStatusCode,
|
'code' => $iStatusCode,
|
||||||
'error_title' => $sErrorTitle,
|
'error_title' => $sErrorTitle,
|
||||||
'error_message' => '',
|
'error_message' => $sErrorMessage,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Generate the response
|
// Generate the response
|
||||||
|
|||||||
Reference in New Issue
Block a user