How to get velocity to raise an error when calling a method with the wrong number of parameters?


When calling a service method in velocity, e.g.:
(there is a missing parameter here), velocity just returns null.

If we do the same call (with missing parameter) in groovy, we get:
Failed to execute the [groovy] macro. Cause: [Expecting at least 2 arguments, a category class and a Closure]. Click on this message for details.

Is there a way for velocity to raise a similar error?

Thanks in advance for your help,

Best regards,


Not sure, that’s at the heart of Velocity behavior and even if it was possible to change this in the Velocity configuration it would most probably break things that count on it.

Thanks for the answer Thomas.