moksha_core/error.rs
1//! This module defines the `MokshaCoreError` enum, which represents the possible errors that can occur in the Moksha Core library.
2//!
3//! The `MokshaCoreError` enum is derived from the `Error` trait using the `thiserror` crate, which allows for easy definition of custom error types with automatic conversion to and from other error types.
4//! All of the variants in the `MokshaCoreError` enum implement the `Error` trait, which allows them to be used with the `?` operator for easy error propagation. The enum is also serializable and deserializable using serde.
5
6use base64::DecodeError;
7use thiserror::Error;
8
9#[derive(Error, Debug)]
10pub enum MokshaCoreError {
11 #[error("Secp256k1Error {0}")]
12 Secp256k1Error(#[from] secp256k1::Error),
13
14 #[error("InvalidTokenType")]
15 InvalidTokenPrefix,
16
17 #[error("Base64DecodeError {0}")]
18 Base64DecodeError(#[from] DecodeError),
19
20 #[error("SerdeJsonError {0}")]
21 SerdeJsonError(#[from] serde_json::Error),
22
23 #[error("Invalid Keysetid")]
24 InvalidKeysetid,
25
26 #[error("Not enough tokens")]
27 NotEnoughTokens,
28
29 #[error("Invalid token")]
30 InvalidToken,
31}