-
Notifications
You must be signed in to change notification settings - Fork 183
JGit: Propagate exceptions when pushing tags/branches #1271
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
Conversation
91becec to
fcc8bd3
Compare
Add tests for all Git providers for failing push operations This closes #1253
fcc8bd3 to
dc9ee71
Compare
|
|
||
| /** | ||
| * Exception thrown when a push operation fails in JGit. | ||
| * This is a custom exception that extends GitAPIException to provide more context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't extend GitAPIException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix it, used to extend it, but it does no longer because it was not necessary/useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 369981b.
|
|
||
| } catch (PushException e) { | ||
| return new BranchScmResult("JGit branch", "Failed to push changes: " + e.getMessage(), "", false); | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be a more specific exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me this is already as specific as it can get. What do you suggest here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is something in the try block throwing a raw java.lang.Exception? It shouldn't be, but it isn't unheard of for APIs to make that mistake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 136 was not touched in this PR and is not related. This can be done in some other PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 136 is related. You've changed the exceptions thrown in the try block. That suggests it's worth looking at the catch blocks to make sure they're still needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed only one potential cause of exceptions. The try block involves lots of other JGit commands, therefore I don't want to change this in this context.
| return new CheckInScmResult("JGit checkin", checkedInFiles); | ||
| } catch (PushException e) { | ||
| return new CheckInScmResult("JGit checkin", "Failed to push changes: " + e.getMessage(), "", false); | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this now be more specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
369981b to
32c5eb9
Compare
|
@kwin Please assign appropriate label to PR according to the type of change. |
Add tests for all Git providers for failing push operations This closes #1253
Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verifyto make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
mvn -Prun-its verify).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.