# Errors

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_flutter/errors

{/* Generated by scripts/generate_reference.dart; do not edit. */}

## BluetoothError [#bluetootherror]

```dart
class BluetoothError implements Exception
```

A failure reported by the Bluetooth runtime or one of its ports.

### Constructors [#constructors]

#### BluetoothError.new [#bluetootherrornew]

```dart
BluetoothError(
  BluetoothErrorCode code,
  String message, [
  Object? cause,
])
```

Creates a Bluetooth error with an optional underlying [`cause`](#bluetootherrorcause).

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `code` | `BluetoothErrorCode` | positional |  |
| `message` | `String` | positional |  |
| `cause` | `Object?` | optional positional |  |

### Properties [#properties]

#### BluetoothError.code [#bluetootherrorcode]

```dart
final BluetoothErrorCode code
```

The category of this failure.

#### BluetoothError.message [#bluetootherrormessage]

```dart
final String message
```

A short description of the failure.

#### BluetoothError.cause [#bluetootherrorcause]

```dart
final Object? cause
```

The error that caused this failure, when available.


## BluetoothErrorCode [#bluetootherrorcode-1]

```dart
enum BluetoothErrorCode
```

A Bluetooth operation's failure category.

### Values [#values]

#### BluetoothErrorCode.permissionDenied [#bluetootherrorcodepermissiondenied]

```dart
static const BluetoothErrorCode permissionDenied
```

The app does not have permission to use Bluetooth.

#### BluetoothErrorCode.poweredOff [#bluetootherrorcodepoweredoff]

```dart
static const BluetoothErrorCode poweredOff
```

Bluetooth is turned off.

#### BluetoothErrorCode.unsupported [#bluetootherrorcodeunsupported]

```dart
static const BluetoothErrorCode unsupported
```

This device does not support Bluetooth LE.

#### BluetoothErrorCode.scanFailed [#bluetootherrorcodescanfailed]

```dart
static const BluetoothErrorCode scanFailed
```

Device scanning failed.

#### BluetoothErrorCode.connectionFailed [#bluetootherrorcodeconnectionfailed]

```dart
static const BluetoothErrorCode connectionFailed
```

A device connection failed.

#### BluetoothErrorCode.pairingRequired [#bluetootherrorcodepairingrequired]

```dart
static const BluetoothErrorCode pairingRequired
```

The device must be paired before it can be used.

#### BluetoothErrorCode.discoveryFailed [#bluetootherrorcodediscoveryfailed]

```dart
static const BluetoothErrorCode discoveryFailed
```

Bluetooth service discovery failed.

#### BluetoothErrorCode.deviceError [#bluetootherrorcodedeviceerror]

```dart
static const BluetoothErrorCode deviceError
```

The device reported an error.

#### BluetoothErrorCode.frameInvalid [#bluetootherrorcodeframeinvalid]

```dart
static const BluetoothErrorCode frameInvalid
```

A device frame was invalid.

#### BluetoothErrorCode.measurementFailed [#bluetootherrorcodemeasurementfailed]

```dart
static const BluetoothErrorCode measurementFailed
```

A device measurement could not be decoded.

#### BluetoothErrorCode.deviceNotFound [#bluetootherrorcodedevicenotfound]

```dart
static const BluetoothErrorCode deviceNotFound
```

The requested device has not been discovered.

#### BluetoothErrorCode.runtimeDisposed [#bluetootherrorcoderuntimedisposed]

```dart
static const BluetoothErrorCode runtimeDisposed
```

The runtime has already been disposed.

#### BluetoothErrorCode.saveFailed [#bluetootherrorcodesavefailed]

```dart
static const BluetoothErrorCode saveFailed
```

A measurement could not be saved.

#### BluetoothErrorCode.unknown [#bluetootherrorcodeunknown]

```dart
static const BluetoothErrorCode unknown
```

The failure does not fit another category.

### Constructors [#constructors-1]

#### BluetoothErrorCode.new [#bluetootherrorcodenew]

```dart
BluetoothErrorCode(String value)
```

Creates a Bluetooth failure category.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `value` | `String` | positional |  |

### Properties [#properties-1]

#### BluetoothErrorCode.value [#bluetootherrorcodevalue]

```dart
final String value
```

The stable contract value for this category.


## asBluetoothError [#asbluetootherror]

```dart
BluetoothError asBluetoothError(Object error, BluetoothErrorCode code)
```

Converts `error` to a [`BluetoothError`](#bluetootherror) with the supplied fallback `code`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `error` | `Object` | positional |  |
| `code` | `BluetoothErrorCode` | positional |  |
