#[non_exhaustive]
pub enum Error {
Truncated,
ExtraneousBytes,
BadLengthValue,
BadMessage(&'static str),
Bug(Bug),
}
Expand description
Error type for decoding Tor objects from bytes.
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.
Truncated
Tried to read something, but we didn’t find enough bytes.
This can mean that the object is truncated, or that we need to read more and try again, depending on the context in which it was received.
ExtraneousBytes
Called Reader::should_be_exhausted(), but found bytes anyway.
BadLengthValue
Invalid length value
BadMessage(&'static str)
An attempt to parse an object failed for some reason related to its contents.
Bug(Bug)
A parsing error that should never happen.
We use this one in lieu of calling assert() and expect() and unwrap() from within parsing code.
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)>
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()