/** * @param string|int|null $id * @param \Exception $exception * * @return Response */ public static function constructExceptionErrorResponse($id, \Exception $exception) { if ($exception instanceof JsonRpcException) { return new self($id, $exception->jsonSerialize(), true); } return self::constructErrorResponse($id, $exception->getMessage(), $exception->getCode()); }