Skip to content

refactor: replace ApiException 'code' with 'status_code' #611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ibmcloudant/features/changes_follower.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def _request_callback(self):
self._buffer.put(e)
break
if (
type(e) is ApiException and e.code in [400, 401, 403, 404]
type(e) is ApiException and e.status_code in [400, 401, 403, 404]
or type(e) is StopIteration
):
self.logger.debug('Terminal error.')
Expand Down
2 changes: 1 addition & 1 deletion test/examples/src/create_db_and_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
if put_database_result["ok"]:
print(f'"{example_db_name}" database created.')
except ApiException as ae:
if ae.code == 412:
if ae.status_code == 412:
print(f'Cannot create "{example_db_name}" database, ' +
'it already exists.')

Expand Down
2 changes: 1 addition & 1 deletion test/examples/src/delete_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
print('You have deleted the document.')

except ApiException as ae:
if ae.code == 404:
if ae.status_code == 404:
print('Cannot delete document because either ' +
f'"{example_db_name}" database or "{example_doc_id}"' +
'document was not found.')
2 changes: 1 addition & 1 deletion test/examples/src/update_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
json.dumps(document, indent=2))

except ApiException as ae:
if ae.code == 404:
if ae.status_code == 404:
print('Cannot delete document because either ' +
f'"{example_db_name}" database or "{example_doc_id}" ' +
'document was not found.')