Errors¶
Errors raised by aio-rfcomm.
Errors that Bluetooth or the other device cause derive from
RfcommError, and are the same on every platform. The platform's own
error, if there is one, is kept as __cause__.
Errors caused by mistakes in your own code derive from RuntimeError
instead, so catching RfcommError never hides a bug.
RfcommError
¶
Bases: Exception
The base class of every error that Bluetooth or the other device causes.
BluetoothUnavailableError
¶
Bases: RfcommError
Bluetooth cannot be used. reason says why.
reason
instance-attribute
¶
reason: UnavailableReason = reason
Why Bluetooth cannot be used. See Availability.
DeviceNotFoundError
¶
Bases: RfcommError
The device did not answer. It may be switched off or out of range.
address
instance-attribute
¶
address: str = address
The device that did not answer, as it was asked for.
ServiceNotFoundError
¶
Bases: RfcommError
The device does not offer that service, or refused that channel number.
The system's stored copy of the device's services may also be out of date.
ConnectionFailedError
¶
Bases: RfcommError
The channel could not be opened, or the service could not be published.
ChannelClosedError
¶
Bases: RfcommError
The connection has ended: the other device hung up, or the connection to it was lost.
Once a connection has ended, and any bytes that arrived before the end
have been received, every call to receive
and send raises this.
DelimiterNotFoundError
¶
Bases: RfcommError
receive_until found no delimiter within
max_bytes.
No bytes were read, so receive can still
read them.
ChannelInUseError
¶
Bases: RfcommError
The RFCOMM channel you asked to serve on is already in use.
Pick another channel, or leave it out to let the library choose.
UnsupportedOperationError
¶
Bases: RfcommError
This platform cannot do that. The message says what to do instead.
BluetoothAlreadyOpenError
¶
Bases: RuntimeError
Bluetooth was opened while it was already open.
Open it once, and pass the object to the functions that need it.
BusyResourceError
¶
Bases: RuntimeError
Two tasks received on one channel at the same time, or two tasks sent.
One task can send while another receives.
ScopeClosedError
¶
Bases: RuntimeError
Something was used after its async with block ended.