Skip to content

Commit

Permalink
Merge pull request #87 from ascopes/bugfix/GH-86-missing-exception-ca…
Browse files Browse the repository at this point in the history
…uses

GH-86: Fix exception causes being omitted from Maven output
  • Loading branch information
ascopes authored Feb 4, 2024
2 parents fbff0d0 + 730fa6e commit bc90e85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ public void execute() throws MojoExecutionException, MojoFailureException {
throw new MojoExecutionException("Protoc invocation failed");
}
} catch (ResolutionException | IOException ex) {
throw new MojoFailureException(this, ex.getMessage(), ex.getMessage());
var mojoFailureException = new MojoFailureException(this, ex.getMessage(), ex.getMessage());
mojoFailureException.initCause(ex);
throw mojoFailureException;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ public Collection<ProtoFileListing> createProtoFileListings(
}

if (!exceptions.isEmpty()) {
var causeIterator = exceptions.iterator();
var ex = new IOException("Failed to create listings asynchronously");
exceptions.forEach(ex::addSuppressed);
ex.initCause(causeIterator.next());
causeIterator.forEachRemaining(ex::addSuppressed);
throw ex;
}

Expand Down

0 comments on commit bc90e85

Please sign in to comment.