function error_displayable

Same name in other branches
  1. 7.x includes/errors.inc \error_displayable()
  2. 8.9.x core/includes/errors.inc \error_displayable()
  3. 10 core/includes/errors.inc \error_displayable()
  4. 11.x core/includes/errors.inc \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

bool TRUE if an error should be displayed.

5 calls to error_displayable()
FinalExceptionSubscriber::isErrorDisplayable in core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php
Wrapper for error_displayable().
SessionHandler::write in core/lib/Drupal/Core/Session/SessionHandler.php
_drupal_exception_handler_additional in core/includes/bootstrap.inc
Displays any additional errors caught while handling an exception.
_drupal_log_error in core/includes/errors.inc
Logs a PHP error or exception and displays an error page in fatal cases.
_drupal_shutdown_function_handle_exception in core/includes/bootstrap.inc
Displays and logs any errors that may happen during shutdown.

File

core/includes/errors.inc, line 119

Code

function error_displayable($error = NULL) {
    if (defined('MAINTENANCE_MODE')) {
        return TRUE;
    }
    $error_level = _drupal_get_error_level();
    if ($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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.