pub unsafe trait SBApplicationDelegate {
// Provided method
unsafe fn eventDidFail_withError(
&self,
event: NonNull<AppleEvent>,
error: &NSError,
) -> Option<Retained<AnyObject>>
where Self: Sized + Message { ... }
}SBApplication only.Expand description
This informal protocol defines a delegation method for handling Apple event errors that are sent from a target application to an <doc ://com.apple.documentation/documentation/scriptingbridge/sbapplication> object.
You must set a delegate for the SBApplication object using the
SBApplication/delegate method. If you do not set a delegate and have the
delegate handle the error in some way, SBApplication raises an
exception.
See also Apple’s documentation
Provided Methods§
Sourceunsafe fn eventDidFail_withError(
&self,
event: NonNull<AppleEvent>,
error: &NSError,
) -> Option<Retained<AnyObject>>
Available on crate feature objc2-core-services only.
unsafe fn eventDidFail_withError( &self, event: NonNull<AppleEvent>, error: &NSError, ) -> Option<Retained<AnyObject>>
objc2-core-services only.Sent by an SBApplication object when a target application returns an error
Apple event.
-
Parameters:
-
event: A pointer to the Apple event sent to the target application causing the error.
-
error: An object containing information about the error Apple event. Specific information may be included in the
useInfodictionary of the error object. The following table shows the possible keys for this dictionary.
| Key | Description |
|---|---|
| ErrorBriefMessage | A short human-readable description of the error, as an |
| <doc | |
| ://com.apple.documentation/documentation/foundation/nsstring> | |
| ErrorExpectedType | The type of data the target application expected, as an |
| <doc | |
| ://com.apple.documentation/documentation/foundation/nsappleeventdescriptor> object. | |
| ErrorOffendingObject | The object that caused the error. |
| ErrorString | A full human-readable description of the error, as an |
| <doc | |
| ://com.apple.documentation/documentation/foundation/nsstring> object. | |
| ErrorNumber | The Apple event error number, as an |
| <doc | |
| ://com.apple.documentation/documentation/foundation/nsnumber> object. |
- Returns: If you return a result, it will become the result of the
<doc
://com.apple.documentation/documentation/appkit/nsapplication/1428359-sendevent>
that failed. Can be
nil.
§Safety
event must be a valid pointer.