8.5.x errors.inc _drupal_get_error_level()
8.0.x errors.inc _drupal_get_error_level()
8.1.x errors.inc _drupal_get_error_level()
8.2.x errors.inc _drupal_get_error_level()
8.3.x errors.inc _drupal_get_error_level()
8.4.x errors.inc _drupal_get_error_level()
8.6.x 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 the kernel being booted or before Drupal is installed. In all other situations the following code is preferred:


Return value

string The current error level.

1 call to _drupal_get_error_level()
error_displayable in core/includes/errors.inc
Determines whether an error should be displayed.


core/includes/errors.inc, line 301
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;

  // Try to get the error level configuration from database. If this fails,
  // for example if the database connection is not there, try to read it from
  // settings.php.
  try {
    $error_level = \Drupal::config('system.logging')
  } catch (\Exception $e) {
    $error_level = isset($GLOBALS['config']['system.logging']['error_level']) ? $GLOBALS['config']['system.logging']['error_level'] : ERROR_REPORTING_HIDE;

  // 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;