2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-25 16:27:11 -07:00

Preserved stacktrace

This commit is contained in:
Erik C. Thauvin 2023-09-15 05:44:19 -07:00
parent 762a63b12f
commit 102d3d3586
2 changed files with 11 additions and 5 deletions

View file

@ -348,12 +348,12 @@ public class PublishOperation extends AbstractOperation<PublishOperation> {
try {
process.waitFor();
} catch (InterruptedException e) {
throw new SignException(file, e.getMessage());
throw new SignException(file, e);
}
if (process.exitValue() != 0) {
var error = FileUtils.readString(process.getErrorStream());
throw new SignException(file, error);
throw new SignException(file);
}
return FileUtils.readString(process.getInputStream());
}

View file

@ -19,10 +19,16 @@ public class SignException extends RuntimeException {
private final File file_;
private final String reason_;
public SignException(File file, String reason) {
super("An error occurred while signing '" + file + "':\n" + reason);
public SignException(File file) {
this(file, null);
}
public SignException(File file, Throwable reason) {
super("An error occurred while signing '" + file, reason);
file_ = file;
reason_ = reason;
if (reason.getCause() != null && reason.getCause().getMessage() != null)
reason_ = reason.getCause().getMessage();
else reason_ = "";
}
public File getFile() {