• 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: user defined error number(s)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: user defined error number(s)


  • Subject: Re: user defined error number(s)
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 03 Jun 2009 11:34:10 -0500

On Jun 3, 2009, at 11:17 AM, Jim Brandt wrote:

Is there an accepted available error number to use for
trapping one's own errors?

Yes!

My applications start out something like this ...

on run
	try
		my main()
	on error errText number errNr
		if errNr = -128 then
			return
		else if errNr = -2700 then
			my showInstruction(errText)
		else
			my showError(errText, errNr, false)
		end if
	end try
end run

If your script has a line such as ...

	if x = 0 then error "You can't select that object."

then the error message is passed with default error number = -2700 and the message is displayed by the showInstruction handler. Any other error is displayed by the showError handler.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >user defined error number(s) (From: Jim Brandt <email@hidden>)

  • Prev by Date: user defined error number(s)
  • Next by Date: Re: On My Mac- FTP checking
  • Previous by thread: user defined error number(s)
  • Next by thread: Re: user defined error number(s)
  • Index(es):
    • Date
    • Thread