Skip to content

Commit

Permalink
Capture exceptions during transformation and log errors
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Dec 4, 2024
1 parent e1e03d0 commit 04724ff
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,16 @@ public GlobalMetadata transformGlobalMetadata(GlobalMetadata globalData) {
templatesRoot.fields().forEachRemaining(template -> {
var templateCopy = (ObjectNode) template.getValue().deepCopy();
var indexTemplate = (Index) () -> templateCopy;
transformIndex(indexTemplate, IndexType.TEMPLATE);
templates.set(template.getKey(), indexTemplate.getRawJson());
try {
transformIndex(indexTemplate, IndexType.TEMPLATE);
templates.set(template.getKey(), indexTemplate.getRawJson());
} catch (Exception e) {
log.atError()
.setMessage("Unable to transform object: {}")
.addArgument(indexTemplate::getRawJson)
.setCause(e)
.log();
}
});
newRoot.set("templates", templates);
}
Expand Down

0 comments on commit 04724ff

Please sign in to comment.