How return an error ?

James Spencer jspencer78 at mac.com
Sat Feb 11 14:31:06 EST 2006


On Feb 11, 2006, at 12:32 PM, Girard Damien wrote:

> I am making some useful library for my softwares, and I have got  
> one problem.
>
> How I return an error ?
>
> Because when I use "return", this doesn't work very great.
>
> on hellotest theNumber
>   if isnumber(theNumber) is false then
>     return "error"
>   end if
>   ...
> end hellotest

I don't understand the problem; you can return whatever you want:

on hellotest pTheNumber
	if not isnumber(pTheNumber) then
		return "ERROR: '" & pTheNumber & "' is not a number."
	end if
	...
end hellotest

then in the calling handler, just test the result:

	...
	hellotest someValue
	if the result is not empty then
		handleError the result
	else
		handleSuccess
	end if
	...

Spence


James P. Spencer
Rochester, MN

jspencer78 at mac.com

"Badges??  We don't need no stinkin badges!"




More information about the use-livecode mailing list