---
title: Exceptions
slug: exceptions
docTags: 
createdAt: 2024-11-27T12:08:56.410Z
---

All exceptions in the SDK inherit from the base `ToroException` class. Below is a comprehensive list of possible exceptions you may encounter:

### Transaction Cancellations

| Exception            | Description                                                          |
| -------------------- | -------------------------------------------------------------------- |
| `TransactionTimeout` | Card was not presented in time and terminal aborted the transaction  |
| `TransactionAborted` | Fallback exception when transaction is aborted for an unknown reason |

### Device-Related Exceptions

| Exception                        | Description                                                                          |
| -------------------------------- | ------------------------------------------------------------------------------------ |
| `DeviceNotSelected`              | No device selected - both `selectedBluetoothDevice` and `selectedUsbDevice` are null |
| `DeviceConnectionFailed`         | Unable to connect to the selected device. Check if it's powered on and nearby        |
| `DeviceDisconnected`             | Connection was closed before the action could be completed                           |
| `DeviceBusy`                     | An action is already in progress on the selected device                              |
| `DeviceError`                    | Generic error relating to a Miura device                                             |
| `DeviceNotSupported`             | Device lacks a required feature (e.g., touchscreen for signature capture)            |
| `DeviceUpdateFailed`             | Error occurred during `executeDeviceUpdate`                                          |
| `CloseBluetoothConnectionFailed` | Failed to close Bluetooth connection with device                                     |

### Card-Related Exceptions

| Exception         | Description                                                               |
| ----------------- | ------------------------------------------------------------------------- |
| `UnsupportedCard` | Presented card is not supported by the terminal (e.g., not EMV compliant) |
| `CardReadError`   | Error reading the card - issue could be with card or terminal hardware    |
| `MagSwipeError`   | Generic error during a magnetic stripe transaction                        |

### Gateway & Communication Exceptions

| Exception                 | Parameters                              | Description                                                              |
| ------------------------- | --------------------------------------- | ------------------------------------------------------------------------ |
| `AcceptorRejected`        | `message: String`<br />`reason: String` | Transaction rejected by Toro Gateway/Acquirer                            |
| `TerminalManagerRejected` | `message: String`<br />`reason: String` | TMS rejected the StatusReport during device updates or parameter updates |
| `GatewayUnavailable`      | `message: String?`                      | No response received from Gateway (timeout)                              |
| `BadGatewayResponse`      | `statusCode: Int`                       | Gateway returned an invalid response                                     |
| `MalformedResponse`       | `message: String`                       | Unexpected data received in Gateway response                             |

### Transaction State Exceptions

| Exception                   | Description                                             |
| --------------------------- | ------------------------------------------------------- |
| `TransactionAlreadyStarted` | Cannot start a new transaction while one is in progress |
| `TransactionError`          | Generic error during transaction                        |

### Security & Resource Exceptions

| Exception                  | Description                                                 |
| -------------------------- | ----------------------------------------------------------- |
| `P2PEException`            | Error during point-to-point encryption operation            |
| `GatewaySecurityException` | Unable to generate or verify security trailer.              |
| `AssetNotFound`            | Required SDK asset not found (e.g., device OS update files) |

### Generic Exceptions

| Exception      | Description                                                 |
| -------------- | ----------------------------------------------------------- |
| `UnknownError` | Generic fallback error when no other exception type applies |

