# Class BluetoothException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.codename1.bluetooth.BluetoothException

public class BluetoothException extends Exception
Thrown via the failure path of every `AsyncResource` returned by the Bluetooth APIs. `getError()` returns a typed `BluetoothError` so callers can react without string-matching the message; for `BluetoothError.GATT_ERROR` failures `getGattStatus()` additionally exposes the raw ATT status code reported by the remote device.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BluetoothException(BluetoothError error)`
  `BluetoothException(BluetoothError error, String message)`
  `BluetoothException(BluetoothError error, String message, int gattStatus)`
  `BluetoothException(BluetoothError error, String message, Throwable cause)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BluetoothError`
  `getError()`
  Typed error code describing the failure.
  `int`
  `getGattStatus()`
  The raw ATT status code reported by the remote GATT server when `getError()` is `BluetoothError.GATT_ERROR`; `-1` otherwise.

  ### Methods inherited from class Throwable

  `addSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### BluetoothException

    public BluetoothException(BluetoothError error)

  - ### BluetoothException

    public BluetoothException(BluetoothError error, String message)

  - ### BluetoothException

    public BluetoothException(BluetoothError error, String message, Throwable cause)

  - ### BluetoothException

    public BluetoothException(BluetoothError error, String message, int gattStatus)

- ## Method Details

  - ### getError

    public BluetoothError getError()
    Typed error code describing the failure. Never `null`.

  - ### getGattStatus

    public int getGattStatus()
    The raw ATT status code reported by the remote GATT server when `getError()` is `BluetoothError.GATT_ERROR`; `-1` otherwise.