openapi-core/openapi_core/schema/responses/exceptions.py
Domen Kožar 6bdd1a6756
Rewrok exception handling
Main motivation behind this change is to be able to catch exceptions
as per raise_for_errors() helpers, but to inspect state of exceptions
instead of just getting a rendered string. This allows rendering
exceptions into JSON, for example.
2018-09-13 10:58:35 +01:00

24 lines
503 B
Python

from openapi_core.schema.exceptions import OpenAPIMappingError
import attr
class OpenAPIResponseError(OpenAPIMappingError):
pass
@attr.s
class InvalidResponse(OpenAPIResponseError):
http_status = attr.ib()
responses = attr.ib()
def __str__(self):
return "Unknown response http status: {0}".format(str(self.http_status))
@attr.s
class MissingResponseContent(OpenAPIResponseError):
response = attr.ib()
def __str__(self):
return "Missing response content"