1pub use crate::protocol::errors::EventCreationError;
4use crate::{approval::error::ApprovalErrorResponse, event::errors::EventError};
5use thiserror::Error;
6
7#[derive(Error, Debug)]
8#[allow(dead_code)]
9pub(crate) enum APIInternalError {
10 #[error("Channel unavailable")]
11 ChannelError,
12 #[error("Oneshot channel not available")]
13 OneshotUnavailable,
14 #[error("An error has ocurred during sign process")]
15 SignError,
16 #[error("Unexpect response received after manager request")]
17 UnexpectedManagerResponse,
18 #[error("Database error {0}")]
19 DatabaseError(String),
20}
21
22#[derive(Error, Debug, Clone)]
24pub enum ApiError {
25 #[error("{}", source)]
26 EventCreationError {
27 #[from]
28 source: EventError,
29 },
30 #[error("{0} not found")]
33 NotFound(String),
34 #[error("Unexpected Response")]
36 UnexpectedError,
37 #[error("An error has ocurred during approval execution. {}", source)]
45 ApprovalInternalError {
46 #[from]
47 source: ApprovalErrorResponse,
48 },
49 #[error("Invalid parameters: {0}")]
51 InvalidParameters(String),
52 #[error("Sign Process Failed")]
54 SignError,
55 #[error("Vote not needed for request {0}")]
57 VoteNotNeeded(String),
58 #[error("Not enough permissions. {0}")]
59 NotEnoughPermissions(String),
60 #[error("A database error has ocurred at API module: {0}")]
61 DatabaseError(String),
62 #[error("Conflict: {0}")]
63 Conflict(String),
64}