|
@@ -132,7 +132,7 @@ public class Shell {
|
|
|
logger.warn("Running command with env: " + env);
|
|
|
Result result = runScriptIgnoreExitCode(command);
|
|
|
if (result.isSuccess() == false) {
|
|
|
- throw new RuntimeException("Command was not successful: [" + String.join(" ", command) + "]\n result: " + result.toString());
|
|
|
+ throw new ShellException("Command was not successful: [" + String.join(" ", command) + "]\n result: " + result.toString());
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@@ -266,4 +266,17 @@ public class Shell {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * An exception to model failures to run a shell command. This exists so that calling code can differentiate between
|
|
|
+ * shell / command errors, and other runtime errors.
|
|
|
+ */
|
|
|
+ public static class ShellException extends RuntimeException {
|
|
|
+ public ShellException(String message) {
|
|
|
+ super(message);
|
|
|
+ }
|
|
|
+
|
|
|
+ public ShellException(String message, Throwable cause) {
|
|
|
+ super(message, cause);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|