public function handle(Exception $e) { foreach ($this->handlers as $handler) { if ($handler->manages($e)) { return $handler->handle($e); } } throw new RuntimeException('Exception handler for ' . get_class($e) . ' not found.'); }
/** * @param Exception $e * @return JsonApiResponse */ public function handle(Exception $e) { $response = $this->errorHandler->handle($e); $document = new Document(); $document->setErrors($response->getErrors()); return new JsonApiResponse($document, $response->getStatus()); }