Contents

AppIntentError

An error that indicates a problem occurred while performing an app intent.

Declaration

struct AppIntentError

Overview

When your app intent encounters an error during execution, throw an AppIntentError to communicate structured failure information to the system. Apple Intelligence, Siri, and Shortcuts use this information to determine the appropriate response — such as prompting a person, retrying the operation, or reporting the failure.

You can create an AppIntentError in several ways:

Predefined errors

Use values from AppIntentError.PermissionRequired, AppIntentError.UserActionRequired, or AppIntentError.Unrecoverable for common failure scenarios that the system already knows how to handle.

Wrapping a custom error

If your error type conforms to CustomLocalizedStringResourceConvertible, pass it to init(wrapping:) to provide a localized description.

Description string

Create an error with a localized description directly from a LocalizedStringResource and pass it to init(description:).

The recommended approach for most apps is to define an error enumeration that conforms to CustomLocalizedStringResourceConvertible` and throw it from your intent's AppIntent/perform()`` method. The framework automatically wraps conforming errors into an AppIntentError with the localized description you provide.

Topics

Getting the error codes

Initializers

Enumerations

Default Implementations

See Also

Errors