pub enum Error {
NotFound(String),
Security(String),
InvalidState(String),
Network(String),
NotSupported(String),
InvalidModification(String),
NotAvailable(Availability),
Timeout(String),
Aborted(String),
}Expand description
Why a Web Bluetooth operation failed.
Variants§
NotFound(String)
No device matched, or the chooser declined to pick one. The spec throws this when the user dismisses the device picker.
Security(String)
The operation is not permitted: a blocklisted UUID, or a service that
was never listed in filters / optional_services.
InvalidState(String)
The object is no longer usable — the device disconnected, or the peripheral re-advertised a different service set and invalidated every handle into the old one.
Network(String)
The GATT operation itself failed: the link dropped mid-request, the
peer rejected it, or connect() never completed.
NotSupported(String)
The characteristic or descriptor does not support what was asked of it —
reading one with no read property, writing one with no write.
InvalidModification(String)
A value was out of range, such as a write longer than the ATT MTU allows.
NotAvailable(Availability)
Bluetooth is unavailable on this system, or this process is not
permitted to use it. Carries the underlying Availability.
Timeout(String)
An operation exceeded its deadline.
Aborted(String)
The operation was cancelled — the future was dropped, or the adapter reset underneath it.
Implementations§
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Availability> for Error
impl From<Availability> for Error
Source§fn from(availability: Availability) -> Self
fn from(availability: Availability) -> Self
The spec resolves a request against an unavailable radio as
NotFoundError, which is what Error::NotAvailable reports — so
? on an availability check inside a function returning Error
produces the same failure the operation itself would have.