mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-07-01 04:21:11 +12:00
Add paragraph utility method for process output exceptions
This commit is contained in:
parent
ec6ef44451
commit
24c5b31a04
|
@ -8,6 +8,12 @@ import java.util.stream.Collectors;
|
||||||
@Getter
|
@Getter
|
||||||
public class ProcessOutputException extends Exception {
|
public class ProcessOutputException extends Exception {
|
||||||
|
|
||||||
|
public static ProcessOutputException withParagraph(String customPrefix, ProcessOutputException ex) {
|
||||||
|
var messageSuffix = ex.getOutput() != null ? ex.getOutput() : "";
|
||||||
|
var message = customPrefix + "\n\n" + messageSuffix;
|
||||||
|
return new ProcessOutputException(message, ex.getExitCode(), ex.getOutput());
|
||||||
|
}
|
||||||
|
|
||||||
public static ProcessOutputException withPrefix(String customPrefix, ProcessOutputException ex) {
|
public static ProcessOutputException withPrefix(String customPrefix, ProcessOutputException ex) {
|
||||||
var messageSuffix = ex.getOutput() != null && !ex.getOutput().isBlank() ? ":\n" + ex.getOutput() : "";
|
var messageSuffix = ex.getOutput() != null && !ex.getOutput().isBlank() ? ":\n" + ex.getOutput() : "";
|
||||||
var message = customPrefix + messageSuffix;
|
var message = customPrefix + messageSuffix;
|
||||||
|
|
Loading…
Reference in a new issue