---
title: "init(error:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nsalert/init(error:)"
---

# init(error:)

Returns an alert initialized from information in an error object.

## Declaration

```swift
init(error: any Error)
```

## Parameters

- `error`: Error information to display.

## Return Value

Return Value An initialized alert.

## Discussion

Discussion The NSAlert class extracts the localized error description, recovery suggestion, and recovery options from the error parameter and uses them as the alert’s message text, informative text, and button titles, respectively.
