From 51fefaa6317476a00c709b72cfd81dbee5cf0878 Mon Sep 17 00:00:00 2001 From: Eryk Kullikowski Date: Mon, 13 May 2024 19:02:13 +0200 Subject: [PATCH] error is logged when ExprFunction is not found by name --- .../github/erykkul/json/transformer/Transformation.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/erykkul/json/transformer/Transformation.java b/src/main/java/io/github/erykkul/json/transformer/Transformation.java index 6df922a..ba767a9 100644 --- a/src/main/java/io/github/erykkul/json/transformer/Transformation.java +++ b/src/main/java/io/github/erykkul/json/transformer/Transformation.java @@ -11,6 +11,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.logging.Logger; import jakarta.json.Json; import jakarta.json.JsonArray; @@ -27,6 +28,7 @@ * @since 1.0.0 */ public class Transformation { + private static final Logger logger = Logger.getLogger(Utils.class.getName()); /** * Executes the expressions. You can call this, e.g., when wrapping a function. @@ -66,7 +68,11 @@ private static JsonValue executeExpression(final TransformationCtx ctx, final Js : ""; final String functionArg = !str.isEmpty() ? str.substring(0, str.length() - 1) : ""; final ExprFunction func = ctx.getFunctions().get(functionName); - return func == null ? result : func.execute(ctx, source, result, functionArg); + if (func == null) { + logger.severe("function \"" + functionName + "\" not found"); + return result; + } + return func.execute(ctx, source, result, functionArg); } return result; }