Skip to content

Commit e5e1b33

Browse files
committed
Simplify output information when an error occurs
1 parent b88b13e commit e5e1b33

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/main/java/com/github/stickerifier/stickerify/process/ProcessHelper.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,17 @@ public static String executeCommand(final String... command) throws ProcessExcep
5959
process.destroyForcibly();
6060
outputThread.join();
6161
errorThread.join();
62-
throw new ProcessException("The command {} timed out after 1m\nStandard output: {}\nStandard error: {}",
63-
command[0],
64-
standardOutput.toString(),
65-
standardError.toString());
62+
LOGGER.at(Level.WARN).log("The command {} timed out after 1m: {}", command[0], standardError.toString());
63+
throw new ProcessException("The command {} timed out after 1m", command[0]);
6664
}
6765

6866
outputThread.join();
6967
errorThread.join();
7068

7169
var exitCode = process.exitValue();
7270
if (exitCode != 0) {
73-
throw new ProcessException("The command {} exited with code {}\nStandard output: {}\nStandard error: {}",
74-
command[0],
75-
exitCode,
76-
standardOutput.toString(),
77-
standardError.toString());
71+
LOGGER.at(Level.WARN).log("The command {} exited with code {}: {}", command[0], exitCode, standardError.toString());
72+
throw new ProcessException("The command {} exited with code {}", command[0], exitCode);
7873
}
7974

8075
return standardOutput.toString();

0 commit comments

Comments
 (0)