Skip to content

Commit d682e3c

Browse files
authored
Merge pull request #43 from apideck-libraries/samz/update-doc
doc: update error handling in migration guide
2 parents bdc3c4a + 9526df2 commit d682e3c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

MIGRATION.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,18 @@ except apideck.ApiException as e:
114114
print("Exception when calling CrmApi->contacts_all: %s\n" % e)
115115
116116
# New SDK
117-
from apideck_unify.errors import ApiError, ValidationError
117+
from apideck_unify import Apideck, models
118118
119119
try:
120120
result = client.crm.contacts.list()
121-
except ValidationError as e:
122-
print("Validation error:", e.message)
123-
except ApiError as e:
124-
print("API error:", e.message, e.status_code)
121+
except models.BadRequestResponse as e:
122+
# handle e.data: models.BadRequestResponseData
123+
raise(e)
124+
except models.UnauthorizedResponse as e:
125+
# handle e.data: models.UnauthorizedResponseData
126+
raise(e)
127+
except models.ApiError as e:
128+
raise(e)
125129
```
126130

127131
For more information about error handling, please check our [documentation](https://github.com/apideck-libraries/sdk-python?tab=readme-ov-file#error-handling)

0 commit comments

Comments
 (0)