use thiserror::Error;
use crate::errors_core::{ErrorSeverity, UserFriendlyError};
use crate::permissions::errors::PermissionsError;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error)]
pub enum Error {
#[error(transparent)]
Permissions(#[from] PermissionsError),
}
impl UserFriendlyError for Error {
fn user_message(&self) -> String {
match self {
Error::Permissions(err) => err.user_message(),
}
}
fn developer_message(&self) -> String {
match self {
Error::Permissions(err) => err.developer_message(),
}
}
fn support_code(&self) -> String {
match self {
Error::Permissions(err) => err.support_code(),
}
}
fn severity(&self) -> ErrorSeverity {
match self {
Error::Permissions(err) => err.severity(),
}
}
fn suggested_actions(&self) -> Vec<String> {
match self {
Error::Permissions(err) => err.suggested_actions(),
}
}
fn is_retryable(&self) -> bool {
match self {
Error::Permissions(err) => err.is_retryable(),
}
}
}