#[non_exhaustive]pub enum Error {
Disconnected(DisconnectReason),
Frame(FrameError),
Handshake(HandshakeError),
Config(String),
Io(Error),
TaskFailed,
}Expand description
Top-level error returned by the ESPHome native API.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Disconnected(DisconnectReason)
The connection ended. This is an expected lifecycle event, not
necessarily a failure — inspect the DisconnectReason to decide.
Frame(FrameError)
A frame could not be turned into a message. The connection is no longer in a known state and is torn down.
Handshake(HandshakeError)
Connection establishment or the encryption handshake failed.
Config(String)
The API was misconfigured (for example, an encryption key that is not valid base64).
Io(Error)
An unexpected I/O error that is not a normal disconnect.
TaskFailed
The connection’s background task terminated without reporting an outcome (for example, it panicked). The session is over, but nothing is known about how it ended.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<FrameError> for Error
impl From<FrameError> for Error
Source§fn from(source: FrameError) -> Self
fn from(source: FrameError) -> Self
Converts to this type from the input type.
Source§impl From<HandshakeError> for Error
impl From<HandshakeError> for Error
Source§fn from(source: HandshakeError) -> Self
fn from(source: HandshakeError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more