You are here

public function ExceptionSubscriber::onException in New Relic 2.x

Same name and namespace in other branches
  1. 8 src/EventSubscriber/ExceptionSubscriber.php \Drupal\new_relic_rpm\EventSubscriber\ExceptionSubscriber::onException()
  2. 2.0.x src/EventSubscriber/ExceptionSubscriber.php \Drupal\new_relic_rpm\EventSubscriber\ExceptionSubscriber::onException()

Handles errors for this subscriber.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The event to process.

File

src/EventSubscriber/ExceptionSubscriber.php, line 49

Class

ExceptionSubscriber
Provides a way to send Exceptions to the New Relic API.

Namespace

Drupal\new_relic_rpm\EventSubscriber

Code

public function onException(GetResponseForExceptionEvent $event) {

  // Don't log http exceptions.
  if ($event
    ->getException() instanceof HttpExceptionInterface) {
    return;
  }
  if (\Drupal::config('new_relic_rpm.settings')
    ->get('override_exception_handler')) {

    // Forward the exception to New Relic.
    $this->adapter
      ->logException($event
      ->getException());
  }
}