function error_displayable

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

TRUE if an error should be displayed.

5 calls to error_displayable()
ExceptionController::on500Html in drupal/core/lib/Drupal/Core/ExceptionController.php
Processes a generic exception into an HTTP 500 response.
_drupal_exception_handler in drupal/core/includes/bootstrap.inc
Provides custom PHP exception handling.
_drupal_log_error in drupal/core/includes/errors.inc
Logs a PHP error or exception and displays an error page in fatal cases.
_drupal_session_write in drupal/core/includes/session.inc
Writes an entire session to the database (internal use only).
_drupal_shutdown_function in drupal/core/includes/bootstrap.inc
Executes registered shutdown functions.

File

drupal/core/includes/errors.inc, line 155
Functions for error handling.

Code

function error_displayable($error = NULL) {
  $error_level = config('system.logging')
    ->get('error_level');
  $updating = defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update';
  $all_errors_displayed = $error_level == ERROR_REPORTING_DISPLAY_ALL || $error_level == ERROR_REPORTING_DISPLAY_VERBOSE;
  $error_needs_display = $error_level == ERROR_REPORTING_DISPLAY_SOME && isset($error) && $error['%type'] != 'Notice' && $error['%type'] != 'Strict warning';
  return $updating || $all_errors_displayed || $error_needs_display;
}