MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / ApiException

Class ApiException

sdks/python/src/e2a/v1/generated/exceptions.py:104–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103
104class ApiException(OpenApiException):
105
106 def __init__(
107 self,
108 status=None,
109 reason=None,
110 http_resp=None,
111 *,
112 body: Optional[str] = None,
113 data: Optional[Any] = None,
114 ) -> None:
115 self.status = status
116 self.reason = reason
117 self.body = body
118 self.data = data
119 self.headers = None
120
121 if http_resp:
122 if self.status is None:
123 self.status = http_resp.status
124 if self.reason is None:
125 self.reason = http_resp.reason
126 if self.body is None:
127 try:
128 self.body = http_resp.data.decode('utf-8')
129 except Exception:
130 pass
131 self.headers = http_resp.getheaders()
132
133 @classmethod
134 def from_response(
135 cls,
136 *,
137 http_resp,
138 body: Optional[str],
139 data: Optional[Any],
140 ) -> Self:
141 if http_resp.status == 400:
142 raise BadRequestException(http_resp=http_resp, body=body, data=data)
143
144 if http_resp.status == 401:
145 raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
146
147 if http_resp.status == 403:
148 raise ForbiddenException(http_resp=http_resp, body=body, data=data)
149
150 if http_resp.status == 404:
151 raise NotFoundException(http_resp=http_resp, body=body, data=data)
152
153 # Added new conditions for 409 and 422
154 if http_resp.status == 409:
155 raise ConflictException(http_resp=http_resp, body=body, data=data)
156
157 if http_resp.status == 422:
158 raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
159
160 if 500 <= http_resp.status <= 599:
161 raise ServiceException(http_resp=http_resp, body=body, data=data)

Callers 5

requestMethod · 0.90
deserializeMethod · 0.90
_excFunction · 0.90
_api_excFunction · 0.90
from_responseMethod · 0.70

Calls

no outgoing calls

Tested by 2

_excFunction · 0.72
_api_excFunction · 0.72