-
Notifications
You must be signed in to change notification settings - Fork 96
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
More consistent exceptions #146
Comments
At the moment, no, it will differ based on the situation. Some of this is due to a couple changes in JGit, but more consistency in exceptions is warranted. I think I'd target this as a 2.0 improvement since it could be breaking to some people. |
Another note on this is that the "context", I add in some places actually covers up a more useful message in the cause exception. Might be better off just wrapping the exception and not providing my own message. |
Since JGit's exceptions are more information, all uses of custom exception types were removed and JGit's are allowed to bubble up, when there isn't any explicit handling needed. This is not quite what the original requester in #146 had in mind, but this seems like a better experience when something fails. For someone trying to catch excpetions, they'll probably need to catch raw Exception. It was unlikely trying to wrap them all was going to be successful anyway.
I realize this is kind of the opposite of what you were looking for but, for 2.0 I've decided to stop having a GrgitException at all. In practice, this means JGit's exception types will bubble up, which are more informative anyway. This does make your situation worse though, since you could get any number of exception types. If you do have a situation where you need to catch everything, you'll need to go all the way to |
Which is close to what I've been already doing. Right now I'm catching |
Groovy doesn't distinguish between checked/unchecked, so it should work out the same. |
Sometimes it's jgit
RepositoryNotFoundException
, sometimes it'sGrgitException
and now I discoveredIllegalArgumentException
. Any way to have single exception I can catch instead?The text was updated successfully, but these errors were encountered: