canic_core/domain/policy/pool/
mod.rs

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