pub enum ProgramError {
Show 26 variants
    Custom(u32),
    InvalidArgument,
    InvalidInstructionData,
    InvalidAccountData,
    AccountDataTooSmall,
    InsufficientFunds,
    IncorrectProgramId,
    MissingRequiredSignature,
    AccountAlreadyInitialized,
    UninitializedAccount,
    NotEnoughAccountKeys,
    AccountBorrowFailed,
    MaxSeedLengthExceeded,
    InvalidSeeds,
    BorshIoError,
    AccountNotRentExempt,
    UnsupportedSysvar,
    IllegalOwner,
    MaxAccountsDataAllocationsExceeded,
    InvalidRealloc,
    MaxInstructionTraceLengthExceeded,
    BuiltinProgramsMustConsumeComputeUnits,
    InvalidAccountOwner,
    ArithmeticOverflow,
    Immutable,
    IncorrectAuthority,
}Expand description
Reasons the program may fail
Variants§
Custom(u32)
Allows on-chain programs to implement program-specific error types and see them returned by the Atlas runtime. A program-specific error may be any type that is represented as or serialized to a u32 integer.
InvalidArgument
InvalidInstructionData
InvalidAccountData
AccountDataTooSmall
InsufficientFunds
IncorrectProgramId
MissingRequiredSignature
AccountAlreadyInitialized
UninitializedAccount
NotEnoughAccountKeys
AccountBorrowFailed
MaxSeedLengthExceeded
InvalidSeeds
BorshIoError
AccountNotRentExempt
UnsupportedSysvar
IllegalOwner
MaxAccountsDataAllocationsExceeded
InvalidRealloc
MaxInstructionTraceLengthExceeded
BuiltinProgramsMustConsumeComputeUnits
InvalidAccountOwner
ArithmeticOverflow
Immutable
IncorrectAuthority
Implementations§
Source§impl ProgramError
 
impl ProgramError
Sourcepub fn to_str<E>(&self) -> &'static str
 
pub fn to_str<E>(&self) -> &'static str
Get an appropriate error string given a program error and an expected
error type, if the error implements TryFrom<u32> and ToStr.
§Example
#[derive(num_enum::TryFromPrimitive)]
#[repr(u32)]
enum MyError {
    A,
    B,
}
impl atlas_program_error::ToStr for MyError {
    fn to_str(&self) -> &'static str {
        match self {
            MyError::A => "Message for A",
            MyError::B => "Some other message for B",
        }
    }
}
let program_error = atlas_program_error::ProgramError::Custom(1);
assert_eq!("Some other message for B", program_error.to_str::<MyError>());Trait Implementations§
Source§impl Clone for ProgramError
 
impl Clone for ProgramError
Source§fn clone(&self) -> ProgramError
 
fn clone(&self) -> ProgramError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moreSource§impl Debug for ProgramError
 
impl Debug for ProgramError
Source§impl<'de> Deserialize<'de> for ProgramError
 
impl<'de> Deserialize<'de> for ProgramError
Source§fn deserialize<__D>(
    __deserializer: __D,
) -> Result<ProgramError, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(
    __deserializer: __D,
) -> Result<ProgramError, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ProgramError
 
impl Display for ProgramError
Source§impl Error for ProgramError
 
impl Error for ProgramError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
 
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
 
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<Error> for ProgramError
 
impl From<Error> for ProgramError
Source§fn from(_error: Error) -> ProgramError
 
fn from(_error: Error) -> ProgramError
Converts to this type from the input type.
Source§impl From<AddressError> for ProgramError
 
impl From<AddressError> for ProgramError
Source§fn from(error: AddressError) -> ProgramError
 
fn from(error: AddressError) -> ProgramError
Converts to this type from the input type.
Source§impl From<SystemError> for ProgramError
 
impl From<SystemError> for ProgramError
Source§fn from(e: SystemError) -> ProgramError
 
fn from(e: SystemError) -> ProgramError
Converts to this type from the input type.
Source§impl From<u64> for ProgramError
 
impl From<u64> for ProgramError
Source§fn from(error: u64) -> ProgramError
 
fn from(error: u64) -> ProgramError
Converts to this type from the input type.
Source§impl PartialEq for ProgramError
 
impl PartialEq for ProgramError
Source§impl Serialize for ProgramError
 
impl Serialize for ProgramError
Source§fn serialize<__S>(
    &self,
    __serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
 
fn serialize<__S>(
    &self,
    __serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl TryFrom<InstructionError> for ProgramError
 
impl TryFrom<InstructionError> for ProgramError
Source§type Error = InstructionError
 
type Error = InstructionError
The type returned in the event of a conversion error.
Source§fn try_from(
    error: InstructionError,
) -> Result<ProgramError, <ProgramError as TryFrom<InstructionError>>::Error>
 
fn try_from( error: InstructionError, ) -> Result<ProgramError, <ProgramError as TryFrom<InstructionError>>::Error>
Performs the conversion.
impl Eq for ProgramError
impl StructuralPartialEq for ProgramError
Auto Trait Implementations§
impl Freeze for ProgramError
impl RefUnwindSafe for ProgramError
impl Send for ProgramError
impl Sync for ProgramError
impl Unpin for ProgramError
impl UnwindSafe for ProgramError
Blanket Implementations§
Source§impl<T> AbiEnumVisitor for T
 
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
Source§impl<T> AbiEnumVisitor for Twhere
    T: Serialize + AbiExample,
 
impl<T> AbiEnumVisitor for Twhere
    T: Serialize + AbiExample,
default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more