1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
use crate::errors::*;
use radix_common::prelude::*;
use radix_engine_interface::blueprints::access_controller::*;
#[derive(Debug, Clone, PartialEq, Eq, ScryptoSbor)]
pub enum AccessControllerError {
/// Occurs when some action requires that the primary role is unlocked to happen.
OperationRequiresUnlockedPrimaryRole,
/// Occurs when adding time to an [`Instant`] results in an overflow
TimeOverflow,
/// Occurs when a proposer attempts to initiate another recovery when they already have a
/// recovery underway.
RecoveryAlreadyExistsForProposer { proposer: Proposer },
/// Occurs when no recovery can be found for a given proposer.
NoRecoveryExistsForProposer { proposer: Proposer },
/// Occurs when a proposer attempts to initiate another badge withdraw when they already have a
/// recovery underway.
BadgeWithdrawAttemptAlreadyExistsForProposer { proposer: Proposer },
/// Occurs when no recovery can be found for a given proposer.
NoBadgeWithdrawAttemptExistsForProposer { proposer: Proposer },
/// Occurs when there is no timed recoveries on the controller - typically because it isn't in
/// the state that allows for it.
NoTimedRecoveriesFound,
/// Occurs when trying to perform a timed confirm recovery on a recovery proposal that could
/// be time-confirmed but whose delay has not yet elapsed.
TimedRecoveryDelayHasNotElapsed,
/// Occurs when the expected recovery proposal doesn't match that which was found
RecoveryProposalMismatch {
expected: Box<RecoveryProposal>,
found: Box<RecoveryProposal>,
},
/// No XRD fee vault exists, one needs to be created by depositing XRD first.
NoXrdFeeVault,
}
impl From<AccessControllerError> for RuntimeError {
fn from(value: AccessControllerError) -> Self {
RuntimeError::ApplicationError(ApplicationError::AccessControllerError(value))
}
}