typed_oid/
error.rs

1//! Defines the convenience [`Result`] type and [`Error`] type
2
3use std::result::Result as StdResult;
4
5/// A convenience type for results where the `E` is a
6/// `seapalne_oid::error::Error`
7pub type Result<T> = StdResult<T, Error>;
8
9/// Errors that can be returned by this crate
10#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
11pub enum Error {
12    #[error("wrong number of bytes to construct Prefix")]
13    PrefixByteLength,
14    #[error("prefix characters may only be 7-bit ASCII values of 2-7,a-z,A-Z")]
15    InvalidPrefix {
16        /// The index of the first invalid character
17        valid_until: usize,
18    },
19    #[error("attempted to deserialize OID without a prefix")]
20    MissingPrefix,
21    #[error("deserialize OID without a separator")]
22    MissingSeparator,
23    #[error("attempted to deserialize OID without a value")]
24    MissingValue,
25    #[error("UUID error: {0}")]
26    Uuid(#[from] uuid::Error),
27    #[error("base32hex Decode error: {0}")]
28    Base32Decode(#[from] data_encoding::DecodeError),
29}