---
title: "virtualMachine(_:didStopWithError:)"
framework: virtualization
role: symbol
role_heading: Instance Method
path: "virtualization/vzvirtualmachinedelegate/virtualmachine(_:didstopwitherror:)"
---

# virtualMachine(_:didStopWithError:)

Tells the delegate that the VM stopped because of an error.

## Declaration

```swift
optional func virtualMachine(_ virtualMachine: VZVirtualMachine, didStopWithError error: any Error)
```

## Parameters

- `virtualMachine`: The VM that called the delegate method.
- `error`: The error.

## See Also

### Stopping the VM

- [guestDidStop(_:)](virtualization/vzvirtualmachinedelegate/guestdidstop(_:).md)
