guts_auth/
error.rs

1//! Error types for the auth crate.
2
3use thiserror::Error;
4
5/// Errors that can occur in authorization operations.
6#[derive(Debug, Error)]
7pub enum AuthError {
8    /// The requested resource was not found.
9    #[error("not found: {0}")]
10    NotFound(String),
11
12    /// The user lacks permission for the operation.
13    #[error("permission denied: {0}")]
14    PermissionDenied(String),
15
16    /// The resource already exists.
17    #[error("already exists: {0}")]
18    AlreadyExists(String),
19
20    /// Invalid input was provided.
21    #[error("invalid input: {0}")]
22    InvalidInput(String),
23
24    /// Cannot remove the last owner of an organization.
25    #[error("cannot remove last owner of organization")]
26    LastOwner,
27
28    /// Branch is protected and operation is not allowed.
29    #[error("branch '{0}' is protected: {1}")]
30    BranchProtected(String, String),
31
32    /// Invalid webhook configuration.
33    #[error("invalid webhook: {0}")]
34    InvalidWebhook(String),
35
36    /// Serialization error.
37    #[error("serialization error: {0}")]
38    Serialization(String),
39}
40
41/// Result type for auth operations.
42pub type Result<T> = std::result::Result<T, AuthError>;