---
title: "attachment(_:didEncounterError:)"
framework: virtualization
role: symbol
role_heading: Instance Method
path: "virtualization/vznetworkblockdevicestoragedeviceattachmentdelegate/attachment(_:didencountererror:)"
---

# attachment(_:didEncounterError:)

The method the attachment object calls when the NBD client encounters a nonrecoverable error.

## Declaration

```swift
optional func attachment(_ attachment: VZNetworkBlockDeviceStorageDeviceAttachment, didEncounterError error: any Error)
```

## Parameters

- `attachment`: The attachment object calling the delegate method.
- `error`: An doc://com.apple.documentation/documentation/Foundation/NSError that describes the nonrecoverable error.

## Discussion

Discussion After the attachment object calls this method, the NBD client is in a nonfunctional state.

## See Also

### Responding to connectivity changes

- [attachmentWasConnected(_:)](virtualization/vznetworkblockdevicestoragedeviceattachmentdelegate/attachmentwasconnected(_:).md)
