32 lines
873 B
Rust
32 lines
873 B
Rust
|
|
use thiserror::Error as ThisError;
|
||
|
|
|
||
|
|
#[non_exhaustive]
|
||
|
|
#[derive(Debug, ThisError)]
|
||
|
|
pub enum Error {
|
||
|
|
#[error("Error while parsing")]
|
||
|
|
Parse { err: ParseError, object: String },
|
||
|
|
#[error("Error while formatting")]
|
||
|
|
Format { err: FormatError, object: String },
|
||
|
|
}
|
||
|
|
|
||
|
|
#[non_exhaustive]
|
||
|
|
#[derive(Debug, ThisError)]
|
||
|
|
pub enum FormatError {
|
||
|
|
#[error("Time Parse Error: {0}")]
|
||
|
|
Datetime(#[from] time::error::Format),
|
||
|
|
}
|
||
|
|
#[non_exhaustive]
|
||
|
|
#[derive(Debug, ThisError)]
|
||
|
|
pub enum ParseError {
|
||
|
|
#[error("Time Parse Error: {0}")]
|
||
|
|
Datetime(#[from] time::error::Parse),
|
||
|
|
#[error("Length of parsed object too long, max: {max:?}, got: {got:?}.")]
|
||
|
|
Length { max: usize, got: usize },
|
||
|
|
#[error("Currently Did is enforced, cannot use handle, {handle:?}")]
|
||
|
|
ForceDid { handle: String },
|
||
|
|
#[error("Incorrectly formatted")]
|
||
|
|
Format,
|
||
|
|
}
|
||
|
|
|
||
|
|
pub type Result<T> = std::result::Result<T, Error>;
|