pub enum MiscCodecError {
InvalidBase64 {
kind: Base64ErrorKind,
input_index: Option<usize>,
symbol: Option<u8>,
input_length: Option<usize>,
source: DecodeError,
},
MissingPrefix {
prefix: String,
},
InvalidDigit {
radix: u32,
index: usize,
character: char,
},
InvalidLength {
context: &'static str,
expected: String,
actual: usize,
},
InvalidEscape {
index: usize,
escape: String,
reason: String,
},
InvalidCharacter {
index: usize,
character: char,
reason: String,
},
InvalidInput {
codec: &'static str,
reason: String,
},
InvalidUtf8 {
source: FromUtf8Error,
},
}Expand description
Error returned by codec operations when input cannot be encoded or decoded.
The variants retain structured details from the codec, including positions in the original input where available.
§Examples
use qubit_codec_misc::MiscCodecError;
let error = MiscCodecError::InvalidInput {
codec: "hex",
reason: "unsupported digit".to_owned(),
};
assert!(matches!(error, MiscCodecError::InvalidInput { codec: "hex", .. }));Variants§
InvalidBase64
Base64 decoding failed with a structured error represented by the dependency type.
Fields
kind: Base64ErrorKindStructured category of the Base64 failure.
source: DecodeErrorUnderlying Base64 decoding error.
MissingPrefix
A configured prefix was required but missing.
InvalidDigit
Input contained a digit that is invalid for the requested radix.
Fields
InvalidLength
Input length does not satisfy a codec requirement.
Fields
InvalidEscape
Input contained a malformed or unsupported escape sequence.
Fields
InvalidCharacter
Input contained a character that cannot appear in that context.
Fields
InvalidInput
Input was rejected by a codec-specific validator.
Fields
InvalidUtf8
Decoded bytes were not valid UTF-8.
Fields
source: FromUtf8ErrorUnderlying UTF-8 conversion error.
Trait Implementations§
Source§impl Debug for MiscCodecError
impl Debug for MiscCodecError
Source§impl Display for MiscCodecError
impl Display for MiscCodecError
Source§impl Error for MiscCodecError
impl Error for MiscCodecError
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<DecodeError> for MiscCodecError
impl From<DecodeError> for MiscCodecError
Source§fn from(source: DecodeError) -> Self
fn from(source: DecodeError) -> Self
Converts a Base64 decoding error and exposes its structured fields.
§Parameters
source: The Base64 decoding error to convert.