changeset 490:334b214e70e9

iptchecknargin: fix error message to use func_name
author carandraug
date Wed, 02 Nov 2011 19:19:52 +0000
parents 737b8c27d24c
children 9d57a245f35a
files inst/iptchecknargin.m
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/inst/iptchecknargin.m
+++ b/inst/iptchecknargin.m
@@ -42,10 +42,15 @@
     error ("Minimun number of arguments cannot be larger than maximum number of arguments")
   endif
 
+  ## error ends in \n so the back trace of the error is not show. This is on
+  ## purpose since the whole idea of this function is already to give a properly
+  ## formatted error message
   if (in < low)
-    error ("Not enough input arguments.");
+    error ("Function %s expected at least %d input arguments(s) but was called instead with %d input argument(s).\n", ...
+           func_name, low, in);
   elseif (in > high)
-    error ("Too many input arguments.");
+    error ("Function %s expected at most %d input argument(s) but was called instead with %d input argument(s).\n", ...
+           func_name, high, in);
   endif
 
 endfunction