function ExceptionLoggingSubscriber::onClientError
Same name in other branches
- 10 core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php \Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber::onClientError()
Log 4xx errors that are not 403 or 404.
Parameters
\Symfony\Component\HttpKernel\Event\ExceptionEvent $event: The event to process.
File
-
core/
lib/ Drupal/ Core/ EventSubscriber/ ExceptionLoggingSubscriber.php, line 84
Class
- ExceptionLoggingSubscriber
- Log exceptions without further handling.
Namespace
Drupal\Core\EventSubscriberCode
public function onClientError(ExceptionEvent $event) {
$exception = $event->getThrowable();
$error = Error::decodeException($exception);
$error += [
'status_code' => $exception->getStatusCode(),
];
unset($error['@backtrace_string']);
$this->logger
->get('client error')
->warning(Error::DEFAULT_ERROR_MESSAGE, $error);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.