Enum anchor_lang::error::ErrorCode

source ·
#[repr(u32)]
pub enum ErrorCode {
Show 77 variants InstructionMissing = 100, InstructionFallbackNotFound = 101, InstructionDidNotDeserialize = 102, InstructionDidNotSerialize = 103, IdlInstructionStub = 1_000, IdlInstructionInvalidProgram = 1001, IdlAccountNotEmpty = 1002, EventInstructionStub = 1_500, ConstraintMut = 2_000, ConstraintHasOne = 2001, ConstraintSigner = 2002, ConstraintRaw = 2003, ConstraintOwner = 2004, ConstraintRentExempt = 2005, ConstraintSeeds = 2006, ConstraintExecutable = 2007, ConstraintState = 2008, ConstraintAssociated = 2009, ConstraintAssociatedInit = 2010, ConstraintClose = 2011, ConstraintAddress = 2012, ConstraintZero = 2013, ConstraintTokenMint = 2014, ConstraintTokenOwner = 2015, ConstraintMintMintAuthority = 2016, ConstraintMintFreezeAuthority = 2017, ConstraintMintDecimals = 2018, ConstraintSpace = 2019, ConstraintAccountIsNone = 2020, ConstraintTokenTokenProgram = 2021, ConstraintMintTokenProgram = 2022, ConstraintAssociatedTokenTokenProgram = 2023, ConstraintMintGroupPointerExtension = 2024, ConstraintMintGroupPointerExtensionAuthority = 2025, ConstraintMintGroupPointerExtensionGroupAddress = 2026, ConstraintMintGroupMemberPointerExtension = 2027, ConstraintMintGroupMemberPointerExtensionAuthority = 2028, ConstraintMintGroupMemberPointerExtensionMemberAddress = 2029, ConstraintMintMetadataPointerExtension = 2030, ConstraintMintMetadataPointerExtensionAuthority = 2031, ConstraintMintMetadataPointerExtensionMetadataAddress = 2032, ConstraintMintCloseAuthorityExtension = 2033, ConstraintMintCloseAuthorityExtensionAuthority = 2034, ConstraintMintPermanentDelegateExtension = 2035, ConstraintMintPermanentDelegateExtensionDelegate = 2036, ConstraintMintTransferHookExtension = 2037, ConstraintMintTransferHookExtensionAuthority = 2038, ConstraintMintTransferHookExtensionProgramId = 2039, RequireViolated = 2_500, RequireEqViolated = 2501, RequireKeysEqViolated = 2502, RequireNeqViolated = 2503, RequireKeysNeqViolated = 2504, RequireGtViolated = 2505, RequireGteViolated = 2506, AccountDiscriminatorAlreadySet = 3_000, AccountDiscriminatorNotFound = 3001, AccountDiscriminatorMismatch = 3002, AccountDidNotDeserialize = 3003, AccountDidNotSerialize = 3004, AccountNotEnoughKeys = 3005, AccountNotMutable = 3006, AccountOwnedByWrongProgram = 3007, InvalidProgramId = 3008, InvalidProgramExecutable = 3009, AccountNotSigner = 3010, AccountNotSystemOwned = 3011, AccountNotInitialized = 3012, AccountNotProgramData = 3013, AccountNotAssociatedTokenAccount = 3014, AccountSysvarMismatch = 3015, AccountReallocExceedsLimit = 3016, AccountDuplicateReallocs = 3017, DeclaredProgramIdMismatch = 4_100, TryingToInitPayerAsProgramAccount = 4_101, InvalidNumericConversion = 4_102, Deprecated = 5_000,
}
Expand description

Error codes that can be returned by internal framework code.

  • >= 100 Instruction error codes
  • >= 1000 IDL error codes
  • >= 2000 constraint error codes
  • >= 3000 account error codes
  • >= 4100 misc error codes
  • = 5000 deprecated error code

The starting point for user-defined errors is defined by the ERROR_CODE_OFFSET.

Variants§

§

InstructionMissing = 100

100 - 8 byte instruction identifier not provided

§

InstructionFallbackNotFound = 101

101 - Fallback functions are not supported

§

InstructionDidNotDeserialize = 102

102 - The program could not deserialize the given instruction

§

InstructionDidNotSerialize = 103

103 - The program could not serialize the given instruction

§

IdlInstructionStub = 1_000

1000 - The program was compiled without idl instructions

§

IdlInstructionInvalidProgram = 1001

1001 - Invalid program given to the IDL instruction

§

IdlAccountNotEmpty = 1002

1002 - IDL Account must be empty in order to resize

§

EventInstructionStub = 1_500

1500 - The program was compiled without event-cpi feature

§

ConstraintMut = 2_000

2000 - A mut constraint was violated

§

ConstraintHasOne = 2001

2001 - A has one constraint was violated

§

ConstraintSigner = 2002

2002 - A signer constraint was violated

§

ConstraintRaw = 2003

2003 - A raw constraint was violated

§

ConstraintOwner = 2004

2004 - An owner constraint was violated

§

ConstraintRentExempt = 2005

2005 - A rent exemption constraint was violated

§

ConstraintSeeds = 2006

2006 - A seeds constraint was violated

§

ConstraintExecutable = 2007

2007 - An executable constraint was violated

§

ConstraintState = 2008

2008 - Deprecated Error, feel free to replace with something else

§

ConstraintAssociated = 2009

2009 - An associated constraint was violated

§

ConstraintAssociatedInit = 2010

2010 - An associated init constraint was violated

§

ConstraintClose = 2011

2011 - A close constraint was violated

§

ConstraintAddress = 2012

2012 - An address constraint was violated

§

ConstraintZero = 2013

2013 - Expected zero account discriminant

§

ConstraintTokenMint = 2014

2014 - A token mint constraint was violated

§

ConstraintTokenOwner = 2015

2015 - A token owner constraint was violated

§

ConstraintMintMintAuthority = 2016

The mint mint is intentional -> a mint authority for the mint.

2016 - A mint mint authority constraint was violated

§

ConstraintMintFreezeAuthority = 2017

2017 - A mint freeze authority constraint was violated

§

ConstraintMintDecimals = 2018

2018 - A mint decimals constraint was violated

§

ConstraintSpace = 2019

2019 - A space constraint was violated

§

ConstraintAccountIsNone = 2020

2020 - A required account for the constraint is None

§

ConstraintTokenTokenProgram = 2021

The token token is intentional -> a token program for the token account.

2021 - A token account token program constraint was violated

§

ConstraintMintTokenProgram = 2022

2022 - A mint token program constraint was violated

§

ConstraintAssociatedTokenTokenProgram = 2023

2023 - A mint token program constraint was violated

§

ConstraintMintGroupPointerExtension = 2024

Extension constraints

2024 - A group pointer extension constraint was violated

§

ConstraintMintGroupPointerExtensionAuthority = 2025

2025 - A group pointer extension authority constraint was violated

§

ConstraintMintGroupPointerExtensionGroupAddress = 2026

2026 - A group pointer extension group address constraint was violated

§

ConstraintMintGroupMemberPointerExtension = 2027

2027 - A group member pointer extension constraint was violated

§

ConstraintMintGroupMemberPointerExtensionAuthority = 2028

2028 - A group member pointer extension authority constraint was violated

§

ConstraintMintGroupMemberPointerExtensionMemberAddress = 2029

2029 - A group member pointer extension member address constraint was violated

§

ConstraintMintMetadataPointerExtension = 2030

2030 - A metadata pointer extension constraint was violated

§

ConstraintMintMetadataPointerExtensionAuthority = 2031

2031 - A metadata pointer extension authority constraint was violated

§

ConstraintMintMetadataPointerExtensionMetadataAddress = 2032

2032 - A metadata pointer extension metadata address constraint was violated

§

ConstraintMintCloseAuthorityExtension = 2033

2033 - A close authority extension constraint was violated

§

ConstraintMintCloseAuthorityExtensionAuthority = 2034

2034 - A close authority extension authority constraint was violated

§

ConstraintMintPermanentDelegateExtension = 2035

2035 - A permanent delegate extension constraint was violated

§

ConstraintMintPermanentDelegateExtensionDelegate = 2036

2036 - A permanent delegate extension authority constraint was violated

§

ConstraintMintTransferHookExtension = 2037

2037 - A transfer hook extension constraint was violated

§

ConstraintMintTransferHookExtensionAuthority = 2038

2038 - A transfer hook extension authority constraint was violated

§

ConstraintMintTransferHookExtensionProgramId = 2039

2039 - A transfer hook extension transfer hook program id constraint was violated

§

RequireViolated = 2_500

2500 - A require expression was violated

§

RequireEqViolated = 2501

2501 - A require_eq expression was violated

§

RequireKeysEqViolated = 2502

2502 - A require_keys_eq expression was violated

§

RequireNeqViolated = 2503

2503 - A require_neq expression was violated

§

RequireKeysNeqViolated = 2504

2504 - A require_keys_neq expression was violated

§

RequireGtViolated = 2505

2505 - A require_gt expression was violated

§

RequireGteViolated = 2506

2506 - A require_gte expression was violated

§

AccountDiscriminatorAlreadySet = 3_000

3000 - The account discriminator was already set on this account

§

AccountDiscriminatorNotFound = 3001

3001 - No 8 byte discriminator was found on the account

§

AccountDiscriminatorMismatch = 3002

3002 - 8 byte discriminator did not match what was expected

§

AccountDidNotDeserialize = 3003

3003 - Failed to deserialize the account

§

AccountDidNotSerialize = 3004

3004 - Failed to serialize the account

§

AccountNotEnoughKeys = 3005

3005 - Not enough account keys given to the instruction

§

AccountNotMutable = 3006

3006 - The given account is not mutable

§

AccountOwnedByWrongProgram = 3007

3007 - The given account is owned by a different program than expected

§

InvalidProgramId = 3008

3008 - Program ID was not as expected

§

InvalidProgramExecutable = 3009

3009 - Program account is not executable

§

AccountNotSigner = 3010

3010 - The given account did not sign

§

AccountNotSystemOwned = 3011

3011 - The given account is not owned by the system program

§

AccountNotInitialized = 3012

3012 - The program expected this account to be already initialized

§

AccountNotProgramData = 3013

3013 - The given account is not a program data account

§

AccountNotAssociatedTokenAccount = 3014

3014 - The given account is not the associated token account

§

AccountSysvarMismatch = 3015

3015 - The given public key does not match the required sysvar

§

AccountReallocExceedsLimit = 3016

3016 - The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit

§

AccountDuplicateReallocs = 3017

3017 - The account was duplicated for more than one reallocation

§

DeclaredProgramIdMismatch = 4_100

4100 - The declared program id does not match actual program id

§

TryingToInitPayerAsProgramAccount = 4_101

4101 - You cannot/should not initialize the payer account as a program account

§

InvalidNumericConversion = 4_102

4102 - Invalid numeric conversion error

§

Deprecated = 5_000

5000 - The API being used is deprecated and should no longer be used

Implementations§

source§

impl ErrorCode

source

pub fn name(&self) -> String

Gets the name of this [#enum_name].

Trait Implementations§

source§

impl Clone for ErrorCode

source§

fn clone(&self) -> ErrorCode

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ErrorCode

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for ErrorCode

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<ErrorCode> for Error

source§

fn from(error_code: ErrorCode) -> Error

Converts to this type from the input type.
source§

impl From<ErrorCode> for u32

source§

fn from(e: ErrorCode) -> u32

Converts to this type from the input type.
source§

impl Copy for ErrorCode

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> AbiExample for T

source§

default fn example() -> T

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V