Notify on an exception
public notifyOnException ( Exception $e, null $extraParams = null ) : string | ||
$e | Exception | |
$extraParams | null | |
Результат | string |
function it_reports_exceptions() { // Arrange. $exception = new UnexpectedValueException(); $extra = ['php' => 'wins']; // Act. $this->report($exception, $extra); // Assert. $this->airbrake->notifyOnException($exception, $extra)->shouldHaveBeenCalled(); }
/** * @param GetResponseForExceptionEvent $event */ public function onKernelException(GetResponseForExceptionEvent $event) { $exception = $event->getException(); foreach ($this->ignoredExceptions as $ignoredException) { if ($exception instanceof $ignoredException) { return; } } $this->client->notifyOnException($exception); error_log('ERRBIT: ' . $exception->getMessage() . ' in: ' . $exception->getFile() . ':' . $exception->getLine()); }
/** * @param Exception $e */ public function report(Exception $e) { $config = new Configuration(env('AIRBRAKE_API_KEY')); $client = new Client($config); $client->notifyOnException($e); return parent::report($e); }
/** * Catches uncaught exceptions. * * @see http://us3.php.net/manual/en/function.set-exception-handler.php * @param \Exception $exception * @return bool */ public function onException(\Exception $exception) { if ($this->shouldNotifyException($exception)) { $this->airbrakeClient->notifyOnException($exception); } return true; }
/** * @param \Exception $exception */ public static function log_exception(\Exception $exception) { if (self::$client instanceof \Airbrake\Client) { self::$client->notifyOnException($exception); } }
/** * Reports the exception to the SaaS platform * * @param Exception $e * @param array $extra * @return mixed */ public function report(Exception $e, array $extra = []) { return $this->airbrake->notifyOnException($e, $extra); }