When initializing AbruptExitException from DetailedExitCode, use its message too.
There shouldn't really be a reason to have two different error messages for the exit code and the exception. If there ever is a good reason, we can add these overloads back.
@@ -42,18 +42,13 @@ public class AbruptExitException extends Exception {
this.detailedExitCode = DetailedExitCode.justExitCode(exitCode);
}
- public AbruptExitException(String message, DetailedExitCode detailedExitCode) {
- super(message);
- this.detailedExitCode = detailedExitCode;
- }
-
- public AbruptExitException(String message, DetailedExitCode detailedExitCode, Throwable cause) {
- super(message, cause);
+ public AbruptExitException(DetailedExitCode detailedExitCode) {
+ super(detailedExitCode.getFailureDetail().getMessage());
this.detailedExitCode = detailedExitCode;
}
public AbruptExitException(DetailedExitCode detailedExitCode, Throwable cause) {
- super(cause);
+ super(detailedExitCode.getFailureDetail().getMessage(), cause);
this.detailedExitCode = detailedExitCode;
}
