use thiserror::Error;
#[derive(Error, Debug)]
pub enum AmiError {
#[error("{provider} error: {message}")]
Provider {
provider: String,
message: String,
},
#[error("Serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("Invalid parameter: {message}")]
InvalidParameter { message: String },
#[error("Operation not supported: {operation}")]
OperationNotSupported { operation: String },
#[error("Resource not found: {resource}")]
ResourceNotFound { resource: String },
#[error("Permission denied: {reason}")]
PermissionDenied { reason: String },
#[error("Access denied: {message}")]
AccessDenied { message: String },
#[error("Resource limit exceeded: {resource_type} limit is {limit}")]
ResourceLimitExceeded { resource_type: String, limit: usize },
#[error("Resource already exists: {resource}")]
ResourceExists { resource: String },
#[error("Store error: {0}")]
StoreError(String),
#[error("policy cannot be read ({policy}): {message}")]
UnreadablePolicy {
policy: String,
message: String,
},
}
pub type Result<T> = std::result::Result<T, AmiError>;
pub mod helpers;
pub use helpers::OptionExt;