|
8 | 8 | from ...core.http_response import AsyncHttpResponse, HttpResponse |
9 | 9 | from ...core.jsonable_encoder import jsonable_encoder |
10 | 10 | from ...core.pagination import AsyncPager, SyncPager |
| 11 | +from ...core.parse_error import ParsingError |
11 | 12 | from ...core.pydantic_utilities import parse_obj_as |
12 | 13 | from ...core.request_options import RequestOptions |
13 | 14 | from ...core.serialization import convert_and_respect_annotation_metadata |
|
28 | 29 | from ...types.get_action_modules_response_content import GetActionModulesResponseContent |
29 | 30 | from ...types.rollback_action_module_response_content import RollbackActionModuleResponseContent |
30 | 31 | from ...types.update_action_module_response_content import UpdateActionModuleResponseContent |
| 32 | +from pydantic import ValidationError |
31 | 33 |
|
32 | 34 | # this is used as the default value for optional parameters |
33 | 35 | OMIT = typing.cast(typing.Any, ...) |
@@ -138,6 +140,10 @@ def list( |
138 | 140 | _response_json = _response.json() |
139 | 141 | except JSONDecodeError: |
140 | 142 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 143 | + except ValidationError as e: |
| 144 | + raise ParsingError( |
| 145 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 146 | + ) |
141 | 147 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
142 | 148 |
|
143 | 149 | def create( |
@@ -271,6 +277,10 @@ def create( |
271 | 277 | _response_json = _response.json() |
272 | 278 | except JSONDecodeError: |
273 | 279 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 280 | + except ValidationError as e: |
| 281 | + raise ParsingError( |
| 282 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 283 | + ) |
274 | 284 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
275 | 285 |
|
276 | 286 | def get( |
@@ -365,6 +375,10 @@ def get( |
365 | 375 | _response_json = _response.json() |
366 | 376 | except JSONDecodeError: |
367 | 377 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 378 | + except ValidationError as e: |
| 379 | + raise ParsingError( |
| 380 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 381 | + ) |
368 | 382 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
369 | 383 |
|
370 | 384 | def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: |
@@ -460,6 +474,10 @@ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = |
460 | 474 | _response_json = _response.json() |
461 | 475 | except JSONDecodeError: |
462 | 476 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 477 | + except ValidationError as e: |
| 478 | + raise ParsingError( |
| 479 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 480 | + ) |
463 | 481 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
464 | 482 |
|
465 | 483 | def update( |
@@ -593,6 +611,10 @@ def update( |
593 | 611 | _response_json = _response.json() |
594 | 612 | except JSONDecodeError: |
595 | 613 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 614 | + except ValidationError as e: |
| 615 | + raise ParsingError( |
| 616 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 617 | + ) |
596 | 618 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
597 | 619 |
|
598 | 620 | def list_actions( |
@@ -712,6 +734,10 @@ def list_actions( |
712 | 734 | _response_json = _response.json() |
713 | 735 | except JSONDecodeError: |
714 | 736 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 737 | + except ValidationError as e: |
| 738 | + raise ParsingError( |
| 739 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 740 | + ) |
715 | 741 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
716 | 742 |
|
717 | 743 | def rollback( |
@@ -827,6 +853,10 @@ def rollback( |
827 | 853 | _response_json = _response.json() |
828 | 854 | except JSONDecodeError: |
829 | 855 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 856 | + except ValidationError as e: |
| 857 | + raise ParsingError( |
| 858 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 859 | + ) |
830 | 860 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
831 | 861 |
|
832 | 862 |
|
@@ -938,6 +968,10 @@ async def _get_next(): |
938 | 968 | _response_json = _response.json() |
939 | 969 | except JSONDecodeError: |
940 | 970 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 971 | + except ValidationError as e: |
| 972 | + raise ParsingError( |
| 973 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 974 | + ) |
941 | 975 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
942 | 976 |
|
943 | 977 | async def create( |
@@ -1071,6 +1105,10 @@ async def create( |
1071 | 1105 | _response_json = _response.json() |
1072 | 1106 | except JSONDecodeError: |
1073 | 1107 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1108 | + except ValidationError as e: |
| 1109 | + raise ParsingError( |
| 1110 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1111 | + ) |
1074 | 1112 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
1075 | 1113 |
|
1076 | 1114 | async def get( |
@@ -1165,6 +1203,10 @@ async def get( |
1165 | 1203 | _response_json = _response.json() |
1166 | 1204 | except JSONDecodeError: |
1167 | 1205 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1206 | + except ValidationError as e: |
| 1207 | + raise ParsingError( |
| 1208 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1209 | + ) |
1168 | 1210 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
1169 | 1211 |
|
1170 | 1212 | async def delete( |
@@ -1262,6 +1304,10 @@ async def delete( |
1262 | 1304 | _response_json = _response.json() |
1263 | 1305 | except JSONDecodeError: |
1264 | 1306 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1307 | + except ValidationError as e: |
| 1308 | + raise ParsingError( |
| 1309 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1310 | + ) |
1265 | 1311 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
1266 | 1312 |
|
1267 | 1313 | async def update( |
@@ -1395,6 +1441,10 @@ async def update( |
1395 | 1441 | _response_json = _response.json() |
1396 | 1442 | except JSONDecodeError: |
1397 | 1443 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1444 | + except ValidationError as e: |
| 1445 | + raise ParsingError( |
| 1446 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1447 | + ) |
1398 | 1448 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
1399 | 1449 |
|
1400 | 1450 | async def list_actions( |
@@ -1517,6 +1567,10 @@ async def _get_next(): |
1517 | 1567 | _response_json = _response.json() |
1518 | 1568 | except JSONDecodeError: |
1519 | 1569 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1570 | + except ValidationError as e: |
| 1571 | + raise ParsingError( |
| 1572 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1573 | + ) |
1520 | 1574 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
1521 | 1575 |
|
1522 | 1576 | async def rollback( |
@@ -1632,4 +1686,8 @@ async def rollback( |
1632 | 1686 | _response_json = _response.json() |
1633 | 1687 | except JSONDecodeError: |
1634 | 1688 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1689 | + except ValidationError as e: |
| 1690 | + raise ParsingError( |
| 1691 | + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1692 | + ) |
1635 | 1693 | raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
0 commit comments