HP Forums

Full Version: Error catching
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi,
I need some help to use error catching, programming for the Prime.
We have IFERR; please, suggest a few example of use for the above purpose...
Then we have also IF TYPE(var) = 5 \\ error ...

My principal goal is to catch errors with parameters or arguments incorrectly entered by the user; i.e. if we have a command myCommand(a, b, c), I want to catch the error if an argument is missing or for error "Bad argument value", to make that program doesn't exit, but give error handled (i.e. a MSGBOX or print() with a string).
An argument can have a default value (a=0) or not, if not and the user don't give it I want to advise him with a meaningful string, instead of the rough, generic, error.

Any hints?

EDIT:
for now, in CAS I'm using something like
Code:

local argv,argc,...;
argv:=[args];
argc:=size(argv);
a := argv(1);
b := argv(argc);
IF argc=3 THEN ...

but in Home, after many tries, I saw that I must use
argc:= CAS.size(argv);
and I'm not able to use argv:= [args], as it gives error, so I try to use only args directly...
Reference URL's