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

25 lines
503 B
Python
Raw Normal View History

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