Re: Throwing Errors in Functions?
Re: Throwing Errors in Functions?
- Subject: Re: Throwing Errors in Functions?
- From: Alex Hall <email@hidden>
- Date: Wed, 11 Mar 2015 00:55:43 -0400
On Mar 11, 2015, at 12:36 AM, Shane Stanley < email@hidden> wrote:
On 11 Mar 2015, at 3:27 pm, Alex Hall < email@hidden> wrote: On a related note, how would I force the script to stop executing if a function errors out?
If the function throws an untrapped error it will be returned to the calling script, so you need to trap it there.
So, the handler stops execution when the error is thrown; good, I hoped it would. But, what about the calling script? Once the error is caught and dealt with, depending on what it was, I'll often want to just stop the entire rest of the script from running. If, for example, the handler was to open a file and that fails, the rest of the script can't run since it has no file to work with. Or, in my case, if the user's privacy settings don't yet grant my script access to the calendar, I want to tell the user about the problem and not run the rest of the script.
--
Have a great day, Alex Hall
|
_______________________________________________
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