public function Js::isErrorDisplayable in JS Callback Handler 8.3
Determines whether an error should be displayed.
When in maintenance mode or when error_level is ERROR_REPORTING_DISPLAY_ALL, all errors should be displayed. For ERROR_REPORTING_DISPLAY_SOME, $error will be examined to determine if it should be displayed.
Parameters
$error: Optional error to examine for ERROR_REPORTING_DISPLAY_SOME.
Return value
bool TRUE if an error should be displayed.
1 call to Js::isErrorDisplayable()
- Js::logError in src/
Js.php - Logs a PHP error or exception and displays the error in fatal cases.
File
- src/
Js.php, line 543
Class
- Js
- JS Callback Handler service.
Namespace
Drupal\jsCode
public function isErrorDisplayable($error = NULL) {
if (defined('MAINTENANCE_MODE')) {
return TRUE;
}
$error_level = NULL;
try {
$error_level = \Drupal::config('system.logging')
->get('error_level');
} catch (\Exception $e) {
$error_level = isset($GLOBALS['config']['system.logging']['error_level']) ? $GLOBALS['config']['system.logging']['error_level'] : ERROR_REPORTING_HIDE;
}
if (!isset($error_level) || $error_level == ERROR_REPORTING_DISPLAY_ALL || $error_level == ERROR_REPORTING_DISPLAY_VERBOSE) {
return TRUE;
}
if ($error_level == ERROR_REPORTING_DISPLAY_SOME && isset($error)) {
return $error['%type'] != 'Notice' && $error['%type'] != 'Strict warning';
}
return FALSE;
}