---
title: "eventDidFail(_:withError:)"
framework: Scripting Bridge
role: symbol
role_heading: Instance Method
platforms: [Mac Catalyst 13.0+, macOS 10.5+]
path: "scriptingbridge/sbapplicationdelegate/eventdidfail(_:witherror:)"
---

# eventDidFail(_:withError:)

Sent by an SBApplication object when a target application returns an error Apple event.

## Declaration

```swift
func eventDidFail(_ event: UnsafePointer<AppleEvent>, withError error: any Error) -> Any?
```

## 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 useInfo dictionary of the error object. The following table shows the possible keys for this dictionary. | | | | | |

## Return Value

Return Value If you return a result, it will become the result of the sendEvent(_:) that failed. Can be nil.
