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

Handle failures in publish invocation #91

Merged
merged 3 commits into from
Mar 3, 2021

Conversation

mrginglymus
Copy link
Contributor

@mrginglymus mrginglymus commented Mar 3, 2021

Given the merge conflicts and circuitous route to the current state, plus the need to rewrite it anyway...here's a new PR accomplishing the same as #83

@timja timja added the bug Something isn't working label Mar 3, 2021
@timja timja changed the title Handle failures in publish invocation, take 2 Handle failures in publish invocation Mar 3, 2021
@codecov
Copy link

codecov bot commented Mar 3, 2021

Codecov Report

Merging #91 (943ad80) into master (4996cf4) will decrease coverage by 1.51%.
The diff coverage is 30.55%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #91      +/-   ##
============================================
- Coverage     87.46%   85.95%   -1.52%     
  Complexity      148      148              
============================================
  Files            17       17              
  Lines           710      726      +16     
  Branches         54       53       -1     
============================================
+ Hits            621      624       +3     
- Misses           71       84      +13     
  Partials         18       18              
Impacted Files Coverage Δ Complexity Δ
...o/jenkins/plugins/checks/steps/WithChecksStep.java 66.01% <30.55%> (-8.70%) 2.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4996cf4...6cabcbd. Read the comment docs.

}
}

private boolean publish(final StepContext context, final ChecksDetails.ChecksDetailsBuilder builder) {
@SuppressWarnings("IllegalCatch")
private boolean publish(final StepContext context, final ChecksDetails.ChecksDetailsBuilder builder) throws WithChecksPublishException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the return value still needed? would it make sense to simply throw the exception each time we want to return false? so we don't call onFailure inside the method but delegate it to the caller which I believe is safer if we want to make sure it is called only once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I think that the boolean return was to avoid having to create a checked exception, but it basically does the same thing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants