public function testSetters() { $event = new ApiExceptionEvent(new Exception()); $event->setException(new InvalidArgumentException()); $this->assertInstanceOf(InvalidArgumentException::class, $event->getException()); }
public function testGetters() { $event = new ApiExceptionEvent(new Exception()); $this->assertInstanceOf(Exception::class, $event->getException()); }
/** * Log an api exception with the request * * @param ApiExceptionEvent $event */ public function onApiException(ApiExceptionEvent $event) { $request = $event->getRequest(); $exception = $event->getException(); $this->logger->error('Request Exception', ['request' => ['method' => $request->getMethod(), 'uri' => rawurldecode((string) $request->getUri()), 'headers' => $request->getHeaders(), 'body' => (string) $request->getBody()], 'exception' => $exception]); }