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

Custom error implementation #1605

Open
BelligerG opened this issue Nov 2, 2021 · 2 comments
Open

Custom error implementation #1605

BelligerG opened this issue Nov 2, 2021 · 2 comments

Comments

@BelligerG
Copy link
Contributor

Errors are raised throughout the code, these would be much more helpful (and help toward any plans for logging) if these were custom "improver" errors rather than the standard python ones

e.g. ValueError raised when a mask is present for an option that does not require a mask in regrid

@cpelley
Copy link
Contributor

cpelley commented Nov 4, 2021

I think defining custom (improver) exceptions is certainly useful in the context where users might write code needing to handle the exception raised. Using built-ins mean writing try-excepts that check the message of the exception before potentially re-raising if not a match - not ideal.

For exceptions you think people are unlikely to catch, are you still proposing to make these 'improver' exceptions?

@BelligerG
Copy link
Contributor Author

I've not put a lot of thought into it at this stage tbh, but I think it'd be good if the non-caught exceptions were still custom improver exceptions unless the standard exceptions were clear enough. I want to make it as painfully obvious as possible what an issue is without digging into the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants