init_data_rust/
errors.rs

1use std::time::SystemTimeError;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum ParseDataError {
6    #[error("Invalid signature: {0}")]
7    InvalidSignature(#[from] serde_json::Error),
8
9    #[error("Invalid query string: {0}")]
10    InvalidQueryString(#[from] url::ParseError),
11}
12
13#[derive(Debug, Error)]
14pub enum SignError {
15    #[error("Could not process signature")]
16    CouldNotProcessSignature,
17
18    #[error("Could not process auth time: {0}")]
19    CouldNotProcessAuthTime(#[from] SystemTimeError),
20}
21
22#[derive(Debug, Error)]
23pub enum ValidationError {
24    #[error("Invalid query string: {0}")]
25    InvalidQueryString(#[from] url::ParseError),
26
27    #[error("Unexpected format")]
28    UnexpectedFormat,
29
30    #[error("Signature is missing")]
31    SignMissing,
32
33    #[error("Auth date is missing")]
34    AuthDateMissing,
35
36    #[error("Data has expired")]
37    Expired,
38
39    #[error("Signature is invalid")]
40    SignInvalid,
41}