canic_core/domain/policy/pool/
mod.rs

1pub mod admissibility;
2pub mod authority;
3
4use crate::{Error, ThisError, cdk::candid::Principal, domain::policy::PolicyError};
5
6///
7/// PoolPolicyError
8/// All semantic denials related to pool policy.
9///
10/// These errors:
11/// - are side-effect free
12/// - are safe to bubble through ops/workflows
13/// - describe *why* an action is not permitted
14///
15
16#[derive(Clone, Debug, Eq, PartialEq, ThisError)]
17pub enum PoolPolicyError {
18    // Admissibility
19    #[error("pool entry blocked for {0}: canister is still registered in subnet registry")]
20    RegisteredInSubnet(Principal),
21
22    #[error("pool entry blocked for {pid}: local non-importable: {details}")]
23    NonImportableOnLocal { pid: Principal, details: String },
24
25    // Recycling
26    #[error("pool entry blocked for {0}: canister not registered in subnet registry")]
27    NotRegisteredInSubnet(Principal),
28
29    // Authority
30    #[error("caller is not authorized to perform pool operation")]
31    NotAuthorized,
32}
33
34impl From<PoolPolicyError> for Error {
35    fn from(err: PoolPolicyError) -> Self {
36        PolicyError::from(err).into()
37    }
38}