pub enum Error {
Comm(String),
Data(String),
BufferEmpty,
Response {
message: String,
kind: Option<ErrorKind>,
status: Option<u8>,
ext: Option<u16>,
},
Request {
message: String,
kind: Option<ErrorKind>,
},
}Expand description
Errors raised by ciplink, one variant per exception class of the Python package.
Variants§
Comm(String)
Connection related failure (CommError).
Data(String)
Binary encoding or decoding failed (DataError).
BufferEmpty
Decoding found no data at all where a value should start (BufferEmptyError).
Response
A reply could not be used (ResponseError); kind is set when the cause is classified.
Fields
Request
A request could not be built from the caller’s input (RequestError).
Implementations§
Source§impl Error
impl Error
Sourcepub fn request_kind(message: impl Into<String>, kind: ErrorKind) -> Self
pub fn request_kind(message: impl Into<String>, kind: ErrorKind) -> Self
A RequestError carrying an ErrorKind.
Sourcepub fn response_tag(error: TagError) -> Self
pub fn response_tag(error: TagError) -> Self
A ResponseError carrying a TagError’s classification.
Sourcepub fn carried_kind(&self) -> Option<ErrorKind>
pub fn carried_kind(&self) -> Option<ErrorKind>
The classification this error carries, if any.
Sourcepub fn default_kind(&self) -> ErrorKind
pub fn default_kind(&self) -> ErrorKind
The default kind of an error caught around a request: RequestError is a bad request, CommError a communication failure, anything else a device error.
Trait Implementations§
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)>
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()
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe 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