-
Notifications
You must be signed in to change notification settings - Fork 4
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
Better exception messages #13
Comments
You are referring to programmatic access to the inner exception with the meaningful message, right? |
Yes, algorithmically trying to deduce which inner exception has the most meaningful message. |
I have another case where the exception messages are misleading. This one in particular is causing us a lot of issues. At seemingly random times,
This exception is thrown here. It's pretty evident that this is originating from the The
The method originally in question, And because we simply report these "soft" non-critical errors as a toast popup to the user, we have no idea which of the two exceptions is actually being thrown. Expected a PR today :) These exceptions re-throws are getting out of hand. |
The exception that could be thrown when clearing the cache provides no meaningful explanation as to why the clearing could have failed.
There are a few exceptions that this
catch
could catch, but most of them will most likely never happen during cache clearing (such as this one since the cache clearing process starts by retrieving keys from the database that do start with the prefix).Clearing errors will typically arise from an exception thrown in
delete()
, which itself also catches and re-throws fromdeleteTransient()
.Ideally, the actual error message is not lost when an exception is caught and re-thrown. This puts burden on consumers to iterate through the stack trace in hopes of finding the actual reason for a failure. That process alone is sketchy at best, as the consumer would need to somehow know how long they should recurse into the stack trace in order to obtain a meaningful error message.
Suggestions:
a. Do not catch and re-thrown exceptions wherever possible
b. Re-thrown exceptions re-use the inner exception's message
c. Re-thrown exceptions append the inner exception's message to their own
The text was updated successfully, but these errors were encountered: