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

Method from_response

sdks/python/src/e2a/v1/generated/exceptions.py:134–162  ·  view source on GitHub ↗
(
        cls, 
        *, 
        http_resp, 
        body: Optional[str], 
        data: Optional[Any],
    )

Source from the content-addressed store, hash-verified

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)
162 raise ApiException(http_resp=http_resp, body=body, data=data)
163
164 def __str__(self):
165 """Custom error messages for exception"""

Callers 1

response_deserializeMethod · 0.80

Calls 8

BadRequestExceptionClass · 0.85
ForbiddenExceptionClass · 0.85
NotFoundExceptionClass · 0.85
ConflictExceptionClass · 0.85
ServiceExceptionClass · 0.85
ApiExceptionClass · 0.70

Tested by

no test coverage detected