2021-06-09 13:02:50 -07:00
|
|
|
use crate::error;
|
2021-01-15 23:05:26 -08:00
|
|
|
|
2021-06-09 13:02:50 -07:00
|
|
|
// Error codes that can be returned by internal framework code.
|
|
|
|
#[error(offset = 0)]
|
2021-01-15 23:05:26 -08:00
|
|
|
pub enum ErrorCode {
|
2021-06-09 13:02:50 -07:00
|
|
|
// Instructions.
|
|
|
|
#[msg("8 byte instruction identifier not provided")]
|
|
|
|
InstructionMissing = 100,
|
|
|
|
#[msg("Fallback functions are not supported")]
|
|
|
|
InstructionFallbackNotFound,
|
|
|
|
#[msg("The program could not deserialize the given instruction")]
|
|
|
|
InstructionDidNotDeserialize,
|
|
|
|
#[msg("The program could not serialize the given instruction")]
|
|
|
|
InstructionDidNotSerialize,
|
2021-01-15 23:05:26 -08:00
|
|
|
|
2021-06-09 13:02:50 -07:00
|
|
|
// IDL instructions.
|
|
|
|
#[msg("The program was compiled without idl instructions")]
|
2021-12-08 13:50:08 -08:00
|
|
|
IdlInstructionStub = 1000,
|
2021-06-09 13:02:50 -07:00
|
|
|
#[msg("Invalid program given to the IDL instruction")]
|
|
|
|
IdlInstructionInvalidProgram,
|
|
|
|
|
|
|
|
// Constraints.
|
|
|
|
#[msg("A mut constraint was violated")]
|
2021-12-08 13:50:08 -08:00
|
|
|
ConstraintMut = 2000,
|
2021-07-03 11:58:23 -07:00
|
|
|
#[msg("A has one constraint was violated")]
|
|
|
|
ConstraintHasOne,
|
2021-12-21 11:13:51 -08:00
|
|
|
#[msg("A signer constraint was violated")]
|
2021-06-09 13:02:50 -07:00
|
|
|
ConstraintSigner,
|
|
|
|
#[msg("A raw constraint was violated")]
|
|
|
|
ConstraintRaw,
|
|
|
|
#[msg("An owner constraint was violated")]
|
|
|
|
ConstraintOwner,
|
|
|
|
#[msg("A rent exemption constraint was violated")]
|
|
|
|
ConstraintRentExempt,
|
|
|
|
#[msg("A seeds constraint was violated")]
|
|
|
|
ConstraintSeeds,
|
|
|
|
#[msg("An executable constraint was violated")]
|
|
|
|
ConstraintExecutable,
|
|
|
|
#[msg("A state constraint was violated")]
|
|
|
|
ConstraintState,
|
|
|
|
#[msg("An associated constraint was violated")]
|
|
|
|
ConstraintAssociated,
|
|
|
|
#[msg("An associated init constraint was violated")]
|
|
|
|
ConstraintAssociatedInit,
|
2021-06-09 15:40:43 -07:00
|
|
|
#[msg("A close constraint was violated")]
|
|
|
|
ConstraintClose,
|
2021-06-27 13:17:05 -07:00
|
|
|
#[msg("An address constraint was violated")]
|
|
|
|
ConstraintAddress,
|
2021-08-29 14:25:38 -07:00
|
|
|
#[msg("Expected zero account discriminant")]
|
|
|
|
ConstraintZero,
|
2021-12-08 13:50:08 -08:00
|
|
|
#[msg("A token mint constraint was violated")]
|
|
|
|
ConstraintTokenMint,
|
|
|
|
#[msg("A token owner constraint was violated")]
|
|
|
|
ConstraintTokenOwner,
|
|
|
|
// The mint mint is intentional -> a mint authority for the mint.
|
|
|
|
#[msg("A mint mint authority constraint was violated")]
|
|
|
|
ConstraintMintMintAuthority,
|
|
|
|
#[msg("A mint freeze authority constraint was violated")]
|
|
|
|
ConstraintMintFreezeAuthority,
|
|
|
|
#[msg("A mint decimals constraint was violated")]
|
|
|
|
ConstraintMintDecimals,
|
|
|
|
#[msg("A space constraint was violated")]
|
|
|
|
ConstraintSpace,
|
2021-06-09 13:02:50 -07:00
|
|
|
|
|
|
|
// Accounts.
|
|
|
|
#[msg("The account discriminator was already set on this account")]
|
2021-12-08 13:50:08 -08:00
|
|
|
AccountDiscriminatorAlreadySet = 3000,
|
2021-06-09 13:02:50 -07:00
|
|
|
#[msg("No 8 byte discriminator was found on the account")]
|
|
|
|
AccountDiscriminatorNotFound,
|
|
|
|
#[msg("8 byte discriminator did not match what was expected")]
|
|
|
|
AccountDiscriminatorMismatch,
|
|
|
|
#[msg("Failed to deserialize the account")]
|
|
|
|
AccountDidNotDeserialize,
|
|
|
|
#[msg("Failed to serialize the account")]
|
|
|
|
AccountDidNotSerialize,
|
|
|
|
#[msg("Not enough account keys given to the instruction")]
|
|
|
|
AccountNotEnoughKeys,
|
|
|
|
#[msg("The given account is not mutable")]
|
|
|
|
AccountNotMutable,
|
2021-12-17 04:34:43 -08:00
|
|
|
#[msg("The given account is owned by a different program than expected")]
|
|
|
|
AccountOwnedByWrongProgram,
|
2021-09-11 14:43:12 -07:00
|
|
|
#[msg("Program ID was not as expected")]
|
|
|
|
InvalidProgramId,
|
|
|
|
#[msg("Program account is not executable")]
|
|
|
|
InvalidProgramExecutable,
|
|
|
|
#[msg("The given account did not sign")]
|
|
|
|
AccountNotSigner,
|
2021-10-30 09:45:06 -07:00
|
|
|
#[msg("The given account is not owned by the system program")]
|
|
|
|
AccountNotSystemOwned,
|
2021-11-18 07:42:07 -08:00
|
|
|
#[msg("The program expected this account to be already initialized")]
|
|
|
|
AccountNotInitialized,
|
2021-12-05 11:14:16 -08:00
|
|
|
#[msg("The given account is not a program data account")]
|
|
|
|
AccountNotProgramData,
|
2021-01-15 23:05:26 -08:00
|
|
|
|
2021-06-09 13:02:50 -07:00
|
|
|
// State.
|
|
|
|
#[msg("The given state account does not have the correct address")]
|
2021-12-08 13:50:08 -08:00
|
|
|
StateInvalidAddress = 4000,
|
2021-01-15 23:05:26 -08:00
|
|
|
|
2021-06-09 13:02:50 -07:00
|
|
|
// Used for APIs that shouldn't be used anymore.
|
|
|
|
#[msg("The API being used is deprecated and should no longer be used")]
|
2021-12-08 13:50:08 -08:00
|
|
|
Deprecated = 5000,
|
2021-01-15 23:05:26 -08:00
|
|
|
}
|