-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: do not catch exceptions occuring inside the plugin (#626)
- Loading branch information
Showing
13 changed files
with
99 additions
and
34 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...ins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/MavenPipelineException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.jenkinsci.plugins.pipeline.maven; | ||
|
||
import static java.util.stream.Collectors.joining; | ||
|
||
import java.util.List; | ||
|
||
import org.jenkinsci.plugins.pipeline.maven.publishers.MavenPipelinePublisherException; | ||
|
||
public class MavenPipelineException extends RuntimeException { | ||
|
||
private static final long serialVersionUID = 4164091766147994893L; | ||
|
||
public MavenPipelineException(Throwable cause) { | ||
super("Exception occured in withMaven pipeline step: " + cause.getMessage(), cause); | ||
} | ||
|
||
public MavenPipelineException(List<MavenPipelinePublisherException> publishersExceptions) { | ||
super(publishersExceptions.size() + " exceptions occured within the publishers of the withMaven pipeline step:\n" | ||
+ publishersExceptions.stream().map(e -> { | ||
StringBuilder builder = new StringBuilder("- "); | ||
builder.append(e.getMessage()); | ||
if (e.getCause() != null) { | ||
builder.append(": ").append(e.getCause().getMessage()); | ||
} | ||
return builder.toString(); | ||
}).collect(joining())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...java/org/jenkinsci/plugins/pipeline/maven/publishers/MavenPipelinePublisherException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.jenkinsci.plugins.pipeline.maven.publishers; | ||
|
||
public class MavenPipelinePublisherException extends RuntimeException { | ||
|
||
private static final long serialVersionUID = -5374242713614539146L; | ||
|
||
private String name; | ||
|
||
private String step; | ||
|
||
public MavenPipelinePublisherException(String name, String step, Throwable cause) { | ||
super(name + " faced exception while " + step, cause); | ||
this.name = name; | ||
this.step = step; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getStep() { | ||
return step; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters