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

Don't raise with the Exception class #66

Closed
edmondchuc opened this issue Mar 17, 2022 · 2 comments
Closed

Don't raise with the Exception class #66

edmondchuc opened this issue Mar 17, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@edmondchuc
Copy link

In a few places in deta/base.py exceptions are raised with the Exception class.

See https://github.com/deta/deta-python/blob/5e68173ffea4b3dd2c3d75fadda4e3c9854d3199/deta/base.py.

raise Exception("Item with key '{4}' already exists".format(key))

raise Exception("Key '{}' not found".format(key))

It'd be better practice if custom exceptions were defined and derived from the general Exception class.

@saadmanrafat
Copy link

saadmanrafat commented Mar 17, 2022

Using Built-in Exceptions would be ideal than writing custom Exceptions. Simple solution would be to use the built-in KeyError Exception. Refactoring the codebase with Custom Exceptions might make it harder for the maintainers, who have their own flow -- just something to think about before creating a PR.

@abdelhai
Copy link
Member

hi @edmondchuc, does PR #69 solve this issue for you?

@abdelhai abdelhai added the enhancement New feature or request label May 17, 2022
@abdelhai abdelhai self-assigned this May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants