mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 00:56:56 +13:00
Add paragraph utility method for process output exceptions
This commit is contained in:
parent
ec6ef44451
commit
24c5b31a04
1 changed files with 6 additions and 0 deletions
|
@ -8,6 +8,12 @@ import java.util.stream.Collectors;
|
|||
@Getter
|
||||
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) {
|
||||
var messageSuffix = ex.getOutput() != null && !ex.getOutput().isBlank() ? ":\n" + ex.getOutput() : "";
|
||||
var message = customPrefix + messageSuffix;
|
||||
|
|
Loading…
Reference in a new issue