Re: Weird try block syntax
Re: Weird try block syntax
- Subject: Re: Weird try block syntax
- From: email@hidden (Michael Sullivan)
- Date: Fri, 25 Jan 2002 14:39:30 -0500
- Organization: Business Card Express
Serge writes:
>
I've just seen this today in a script I'm testing, as well as in
>
samples from Jon's commands:
>
try
>
>
on error number -n
>
>
end
>
with n being just about any number needed.
>
I didn't know such construct existed. My first reaction would be that
>
this is bogus, but who am I to contradict Jon Pugh? :)
>
So is it a feature of Jon's commands- which I'm using actually- or
>
from an editor I'm not using (only Smile and SE?)
AFAIK it's the raw AS language. I use it all the time to throw
exceptions in handlers.
If I want to throw an exception (exit with an error condition) in a
handler, I use the command:
error <someMessage> number <someNumber>
and document the possible numbers and messages that can be thrown
In the try block, I can then catch specific errors and do appropriate
things with them. and if my client script doesn't recognize the number
then just pass the error through or use a generic error message routine.
Michael
--
Michael Sullivan
Business Card Express of CT Thermographers to the Trade
Cheshire, CT email@hidden