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")]
|
|
|
|
IdlInstructionStub = 120,
|
|
|
|
#[msg("Invalid program given to the IDL instruction")]
|
|
|
|
IdlInstructionInvalidProgram,
|
|
|
|
|
|
|
|
// Constraints.
|
|
|
|
#[msg("A mut constraint was violated")]
|
|
|
|
ConstraintMut = 140,
|
|
|
|
#[msg("A belongs to constraint was violated")]
|
|
|
|
ConstraintBelongsTo,
|
|
|
|
#[msg("A signer constraint as violated")]
|
|
|
|
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-09 13:02:50 -07:00
|
|
|
|
|
|
|
// Accounts.
|
|
|
|
#[msg("The account discriminator was already set on this account")]
|
|
|
|
AccountDiscriminatorAlreadySet = 160,
|
|
|
|
#[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,
|
|
|
|
#[msg("The given account is not owned by the executing program")]
|
|
|
|
AccountNotProgramOwned,
|
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")]
|
|
|
|
StateInvalidAddress = 180,
|
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")]
|
|
|
|
Deprecated = 299,
|
2021-01-15 23:05:26 -08:00
|
|
|
}
|