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

Make ErrorAction.equals a public API #289

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import org.jenkinsci.plugins.workflow.graph.AtomNode;
import org.jenkinsci.plugins.workflow.graph.BlockEndNode;
import org.jenkinsci.plugins.workflow.graphanalysis.ForkScanner;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.Beta;

/**
* Attached to {@link FlowNode} that caused an error.
Expand Down Expand Up @@ -165,7 +167,8 @@ public String getUrlName() {
* {@link Throwable#equals} might not be reliable if the program has resumed
* and stuff is deserialized.
*/
private static boolean equals(Throwable t1, Throwable t2) {
@Restricted(Beta.class)
public static boolean equals(Throwable t1, Throwable t2) {
Copy link
Member Author

Choose a reason for hiding this comment

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

For my particular case, I could instead create a new public static boolean isRethrown(FlowNode node) method that checks whether the ErrorAction on the associated FlowNode was also thrown by one of its immediate parents, but exposing equals directly does not seem particularly problematic to me and may be useful in other cases.

if (t1 == t2) {
return true;
} else if (t1.getClass() != t2.getClass()) {
Expand Down