improver icon indicating copy to clipboard operation
improver copied to clipboard

Custom error implementation

Open BelligerG opened this issue 4 years ago • 2 comments

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

BelligerG avatar Nov 02 '21 11:11 BelligerG

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?

cpelley avatar Nov 04 '21 12:11 cpelley

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

BelligerG avatar Nov 04 '21 13:11 BelligerG