Skip to main content

modkit_db/secure/
error.rs

1use uuid::Uuid;
2
3/// Errors that can occur during scoped query execution.
4#[derive(thiserror::Error, Debug)]
5pub enum ScopeError {
6    /// Database error occurred during query execution.
7    #[error("database error: {0}")]
8    Db(#[from] sea_orm::DbErr),
9
10    /// Invalid scope configuration.
11    #[error("invalid scope: {0}")]
12    Invalid(&'static str),
13
14    /// Tenant isolation violation: `tenant_id` is not included in the current scope.
15    #[error("access denied: tenant_id not present in security scope ({tenant_id})")]
16    TenantNotInScope { tenant_id: Uuid },
17
18    /// Operation denied - entity not accessible in current security scope.
19    #[error("access denied: {0}")]
20    Denied(&'static str),
21}