This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch 2.3-gae
in repository https://gitbox.apache.org/repos/asf/freemarker.git


The following commit(s) were added to refs/heads/2.3-gae by this push:
     new 6059fc2  Show valid parameter names in the error message when a macro 
is called with an invalid parameter name
6059fc2 is described below

commit 6059fc2ef25b4f332edda0e350ae3d3243e150ba
Author: ddekany <[email protected]>
AuthorDate: Sun Oct 27 17:52:19 2019 +0100

    Show valid parameter names in the error message when a macro is called with 
an invalid parameter name
---
 src/main/java/freemarker/core/Environment.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/freemarker/core/Environment.java 
b/src/main/java/freemarker/core/Environment.java
index 13ef380..7338895 100644
--- a/src/main/java/freemarker/core/Environment.java
+++ b/src/main/java/freemarker/core/Environment.java
@@ -1056,7 +1056,8 @@ public final class Environment extends Configurable {
     private _MiscTemplateException newUndeclaredParamNameException(Macro 
macro, String argName) {
         return new _MiscTemplateException(this,
                 (macro.isFunction() ? "Function " : "Macro "), new 
_DelayedJQuote(macro.getName()),
-                " has no parameter with name ", new _DelayedJQuote(argName), 
".");
+                " has no parameter with name ", new _DelayedJQuote(argName), 
". Valid parameter names are: "
+                , new _DelayedJoinWithComma(macro.getArgumentNames()));
     }
 
     private _MiscTemplateException 
newBothNamedAndPositionalCatchAllParamsException(Macro macro) {

Reply via email to