hab_rs/
error.rs

1use std::num::ParseFloatError;
2
3use thiserror::Error;
4
5/// Errors produced by hab-rs
6#[derive(Error, Debug)]
7pub enum HabRsError {
8    /// Could not parse a value.
9    #[error("could not parse string: {0}")]
10    Parse(String),
11    /// Could not parse a float.
12    #[error("could not parse string into float: {0}")]
13    ParseFloat(#[from] ParseFloatError),
14    /// Could not parse date and/or time.
15    #[error("could not parse string into date/time: {0}")]
16    ParseDateTime(#[from] chrono::format::ParseError),
17    /// Could not serialize/deserialize a JSON value.
18    #[error("json error")]
19    Json(#[from] serde_json::Error),
20    /// Could not decode Base64 string.
21    #[error("could not decode as base64: {0}")]
22    Base64(#[from] base64::DecodeError),
23}