Post Reply 
Error catching
02-23-2015, 02:25 PM (This post was last modified: 02-23-2015 04:54 PM by salvomic.)
Post: #1
Error catching
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...

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)