Skip to content
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

All database errors are DatabaseErrors #349

Open
rrooij opened this issue Sep 6, 2022 · 0 comments
Open

All database errors are DatabaseErrors #349

rrooij opened this issue Sep 6, 2022 · 0 comments
Labels
area: python client relevant to python client bug Something isn't working triage issue to be triage

Comments

@rrooij
Copy link
Contributor

rrooij commented Sep 6, 2022

Almost all database errors return the DatabaseError exception. They should return a specific exception instead as a DatabaseException can mean almost anything and catch code for specific errors can become very dirty.

See for instance:

except DatabaseError as exception:
body = exception.error_obj
if exception.status_code == 404 and "api:error" in body and body["api:error"]["@type"] == "api:DocumentNotFound":
return False
raise exception

This could would be more elegant if DocumentNotFound was a specific exception.

@rrooij rrooij added the bug Something isn't working label Sep 6, 2022
@github-actions github-actions bot added area: python client relevant to python client triage issue to be triage labels Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: python client relevant to python client bug Something isn't working triage issue to be triage
Projects
None yet
Development

No branches or pull requests

1 participant