Errors
All errors are represented by the ToroError enum which conforms to Swift's standard Error protocol. Below is a list of possible errors you may encounter:
Error Categories
All errors in the SDK belong to one of the following categories:
User Cancellations
Error Type | Description |
|---|---|
customerCancelled | Transaction was cancelled by the customer on the payment terminal |
operatorCancelled | Transaction was cancelled in-app by calling toro.cancelTransaction() |
Device-Related Errors
Error Type | Description |
|---|---|
deviceConnectionFailed | Unable to connect to the selected device |
deviceNotSelected | No device selected - must set via toro.selectedDevice property |
deviceDisconnected | Connection was lost during operation |
deviceError | Generic device error with descriptive message |
deviceBusy | An operation is already in progress on the selected device |
deviceUpdateFailed | Error occurred during device firmware/configuration update |
deviceNotSupported | Device lacks a required feature for the requested operation |
closeBluetoothConnectionFailed | Failed to close Bluetooth connection with device |
Card-Related Errors
Error Type | Description |
|---|---|
unsupportedCard | Presented card is not supported by the terminal |
cardReadError | Error reading the card - issue could be with card or terminal hardware |
magSwipeError | Error during a magnetic stripe transaction |
Transaction State Errors
Error Type | Description |
|---|---|
transactionAlreadyStarted | Cannot start a new transaction while one is in progress |
transactionAborted | Transaction was aborted for an unspecified reason |
transactionTimeout | Card was not presented within the time limit |
transactionError | Generic transaction error with descriptive message |
Gateway & Communication Errors
Error Type | Description |
|---|---|
acceptorRejected | Transaction rejected by Toro Gateway/Acquirer |
terminalManagerRejected | TMS rejected the StatusReport during device or parameter updates |
gatewayUnavailable | No response received from Gateway (timeout) |
badGatewayResponse | Gateway returned an invalid response |
malformedResponse | Unexpected data format received in Gateway response |
malformedRequest | Request could not be properly formatted |
gatewaySecurityException | Error during security trailer generation or verification |
Resource & Validation Errors
Error Type | Description |
|---|---|
p2peError | Error during point-to-point encryption operation |
assetNotFound | Required SDK asset not found |
validationError | Input validation failed with descriptive message |
Generic Errors
Error Type | Description |
|---|---|
unknownError | Generic fallback error when no specific type applies |
Error Properties
Each ToroError provides two helpful properties:
- message: A detailed description of what went wrong
- title: A shorter title suitable for UI display