8 errors.inc _drupal_get_error_level()

Returns the current error level.

This function should only be used to get the current error level prior to DRUPAL_BOOTSTRAP_KERNEL or before Drupal is installed. In all other situations the following code is preferred:


Return value

string The current error level.

2 calls to _drupal_get_error_level()
error_displayable in core/includes/errors.inc
Determines whether an error should be displayed.
_drupal_log_error in core/includes/errors.inc
Logs a PHP error or exception and displays an error page in fatal cases.


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


function _drupal_get_error_level() {
  // Raise the error level to maximum for the installer, so users are able to
  // file proper bug reports for installer errors. The returned value is
  // different to the one below, because the installer actually has a
  // 'config.factory' service, which reads the default 'error_level' value from
  // System module's default configuration and the default value is not verbose.
  // @see error_displayable()
  if (drupal_installation_attempted()) {
  $error_level = NULL;
  if (\Drupal::hasService('config.factory')) {
    $error_level = \Drupal::config('system.logging')->get('error_level');
  // If there is no container or if it has no config.factory service, we are
  // possibly in an edge-case error situation while trying to serve a regular
  // request on a public site, so use the non-verbose default value.
  return $error_level ? : ERROR_REPORTING_DISPLAY_ALL;