Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: catching errors on "with administrator privileges"




On 21 Jun 2006, at 15:24, deivy petrescu wrote:

enter the wrong password and get the error number:
-->   -60005

It may already be clear Jeremy but, just to follow through on Deivy & Emmanuel's good advice...


If you have several potential error types on which you wish to take further action, you can simply use a series of if/then statements. While the following example will handle cancellations and authentication failures, it will still throw an error if any other exception occurs:

--------

try
do shell script "" with administrator privileges
simulated_error()
on error e number n
if n is -128 then -- perform any action(s) required following a user cancellation - for example:
display dialog "Had enough?"
else if n is -60005 then -- similar sort of thing for an authentication failure:
display dialog "Memory playing tricks on you?"
else -- reissue any error that hasn't already been trapped/remapped
error e number n
end if
end try


--------

---
kai


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

This email sent to email@hidden
References: 
 >catching errors on "with administrator privileges" (From: Jeremy Matthews <email@hidden>)
 >Re: catching errors on "with administrator privileges" (From: deivy petrescu <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.