openapi-core/openapi_core/schema/responses/exceptions.py

26 lines
538 B
Python
Raw Normal View History

import attr
2019-06-18 11:39:07 +00:00
from openapi_core.schema.exceptions import OpenAPIMappingError
2018-04-18 10:39:03 +00:00
class OpenAPIResponseError(OpenAPIMappingError):
pass
2019-06-18 11:39:07 +00:00
@attr.s(hash=True)
2018-04-18 10:39:03 +00:00
class InvalidResponse(OpenAPIResponseError):
http_status = attr.ib()
responses = attr.ib()
def __str__(self):
2020-01-17 14:36:14 +00:00
return "Unknown response http status: {0}".format(
str(self.http_status))
2018-04-18 10:39:03 +00:00
2019-06-18 11:39:07 +00:00
@attr.s(hash=True)
2018-04-18 10:39:03 +00:00
class MissingResponseContent(OpenAPIResponseError):
response = attr.ib()
def __str__(self):
return "Missing response content"