buster/api/libs/sharing/src/errors.rs

37 lines
911 B
Rust
Raw Normal View History

2025-03-19 23:35:56 +08:00
use thiserror::Error;
#[derive(Error, Debug)]
pub enum SharingError {
2025-03-20 00:04:36 +08:00
#[error("Database error: {0}")]
DatabaseError(#[from] diesel::result::Error),
2025-03-19 23:35:56 +08:00
#[error("User not found: {0}")]
UserNotFound(String),
#[error("Invalid permission role: {0}")]
InvalidPermissionRole(String),
2025-03-19 23:48:56 +08:00
#[error("Deprecated asset type: {0}")]
2025-03-19 23:35:56 +08:00
DeprecatedAssetType(String),
#[error("Permission denied: {0}")]
PermissionDenied(String),
2025-03-19 23:48:56 +08:00
#[error("Invalid email address: {0}")]
InvalidEmail(String),
2025-03-19 23:41:29 +08:00
#[error("Asset not found: {0}")]
AssetNotFound(String),
2025-03-20 00:04:36 +08:00
#[error("Permission not found for asset {0}")]
PermissionNotFound(String),
2025-03-19 23:41:29 +08:00
2025-03-20 00:04:36 +08:00
#[error("Insufficient permissions to perform this action")]
InsufficientPermissions,
2025-03-19 23:35:56 +08:00
2025-03-19 23:41:29 +08:00
#[error("Internal error: {0}")]
InternalError(String),
2025-03-19 23:48:56 +08:00
2025-03-19 23:35:56 +08:00
#[error("Unknown error: {0}")]
Unknown(String),
}