pub use crate::protocol::errors::EventCreationError;
use crate::{approval::error::ApprovalErrorResponse, event::errors::EventError};
use thiserror::Error;
#[derive(Error, Debug)]
#[allow(dead_code)]
pub(crate) enum APIInternalError {
#[error("Channel unavailable")]
ChannelError,
#[error("Oneshot channel not available")]
OneshotUnavailable,
#[error("An error has ocurred during sign process")]
SignError,
#[error("Unexpect response received after manager request")]
UnexpectedManagerResponse,
#[error("Database error {0}")]
DatabaseError(String),
}
#[derive(Error, Debug, Clone)]
pub enum ApiError {
#[error("{}", source)]
EventCreationError {
#[from]
source: EventError,
},
#[error("{0} not found")]
NotFound(String),
#[error("Unexpected Response")]
UnexpectedError,
#[error("An error has ocurred during approval execution. {}", source)]
ApprovalInternalError {
#[from]
source: ApprovalErrorResponse,
},
#[error("Invalid parameters: {0}")]
InvalidParameters(String),
#[error("Sign Process Failed")]
SignError,
#[error("Vote not needed for request {0}")]
VoteNotNeeded(String),
#[error("Not enough permissions. {0}")]
NotEnoughPermissions(String),
#[error("A database error has ocurred at API module: {0}")]
DatabaseError(String),
#[error("Conflict: {0}")]
Conflict(String),
}