diff --git a/nop-xlang/src/main/java/io/nop/xlang/api/XLang.java b/nop-xlang/src/main/java/io/nop/xlang/api/XLang.java index 1cebf28d5..41a251e16 100644 --- a/nop-xlang/src/main/java/io/nop/xlang/api/XLang.java +++ b/nop-xlang/src/main/java/io/nop/xlang/api/XLang.java @@ -79,16 +79,24 @@ public static XplModel loadTpl(String path) { return (XplModel) ResourceComponentManager.instance().loadComponentModel(path); } - public static AbstractEvalAction getTagAction(String libPath, String tagName) { + public static AbstractEvalAction getTagAction(String libPath, String tagName, boolean isException) { IXplTagLib lib = (IXplTagLib) ResourceComponentManager.instance().loadComponentModel(libPath); IXplTag tag = lib.getTag(tagName); - if (tag == null) - throw new NopException(ERR_XLIB_UNKNOWN_TAG).param(ARG_LIB_PATH, libPath).param(ARG_TAG_NAME, tagName); + if (tag == null) { + if (isException) { + throw new NopException(ERR_XLIB_UNKNOWN_TAG).param(ARG_LIB_PATH, libPath).param(ARG_TAG_NAME, tagName); + } + return null; + } IFunctionModel func = tag.getFunctionModel(); return new ExecutableFunctionEvalAction(func); } + public static AbstractEvalAction getTagAction(String libPath, String tagName) { + return getTagAction(libPath, tagName, true); + } + public static IXplTag getTag(String libPath, String tagName) { IXplTagLib lib = (IXplTagLib) ResourceComponentManager.instance().loadComponentModel(libPath); IXplTag tag = lib.getTag(tagName);