How return an error ?

Alex Tweedly alex at tweedly.net
Sat Feb 11 15:57:02 EST 2006


Girard Damien wrote:

>
> I wan't to return a specific error message (internaly in Runrev), I 
> wrote  complex commands, who call a lot of subcommands and functions, 
> and when an  error is uncountered, I wan't to return it. The advantage 
> is to permit to  the developers to understand why there is an error. 
> And this permit to the  software to manage these errors. (For exemple, 
> you call a command
> in a try structure, and you can manage this error with catch).
>
Aha !
I think this is the key - you don't want to "return" an error in the 
usual sense. You want to cause an error, which the caller can catch 
using a "try ...catch ... end try".

You can do this using the "throw" command; it's fairly well described in 
the docs. It allows you to "throw" an error, which can be caught by a 
matching try ...catch... end try clause. If there is no such structure, 
then it causes an error dialog message (just like Rev's internal errors).


-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.2/253 - Release Date: 07/02/2006




More information about the use-livecode mailing list