• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Weird try block syntax
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Weird try block syntax (From: "Serge Belleudy-d'Espinose" <email@hidden>)

  • Prev by Date: Re: Applescript editor recommendations?
  • Next by Date: Re: Weird try block syntax
  • Previous by thread: Re: Weird try block syntax
  • Next by thread: Re: Weird try block syntax
  • Index(es):
    • Date
    • Thread