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