Skip to content

Commit

Permalink
Update error handling configuration in README example
Browse files Browse the repository at this point in the history
Revised the README example to demonstrate different exception resolver options for OfficeStamperConfiguration. This includes throwing errors immediately, passing errors without stopping, and replacing erroneous placeholders with a default value.
  • Loading branch information
caring-coder committed Sep 23, 2024
1 parent c4f62c0 commit 59fe000
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,11 @@ Follow the given example to silence the exception and keep OfficeStamper from fa
----
class Main {
public static void main(String... args) {
var configuration = OfficeStamperConfiguration.standardWithPreprocessing()
.setFailOnUnresolvedExpression(false);
var configuration = OfficeStamperConfiguration
.standardWithPreprocessing()
.setExceptionResolver(ExceptionResolvers.throwing()); // to throw as soon as an error occurs (default)
// .setExceptionResolver(ExceptionResolvers.passing()); // to do nothing on error, leaving erroneous placeholders in place, and log the error
// .setExceptionResolver(ExceptionResolvers.defaulting("value")); // to replace erroneous placeholders by a default value, and log the error
var stamper = OfficeStampers.docxStamper(configuration);
}
}
Expand Down

0 comments on commit 59fe000

Please sign in to comment.