use num_derive::FromPrimitive;
use thiserror::Error;
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum MplCoreError {
#[error("Invalid System Program")]
InvalidSystemProgram,
#[error("Error deserializing account")]
DeserializationError,
#[error("Error serializing account")]
SerializationError,
#[error("Plugins not initialized")]
PluginsNotInitialized,
#[error("Plugin not found")]
PluginNotFound,
#[error("Numerical Overflow")]
NumericalOverflow,
#[error("Incorrect account")]
IncorrectAccount,
#[error("Incorrect asset hash")]
IncorrectAssetHash,
#[error("Invalid Plugin")]
InvalidPlugin,
#[error("Invalid Authority")]
InvalidAuthority,
#[error("Cannot transfer a frozen asset")]
AssetIsFrozen,
#[error("Missing compression proof")]
MissingCompressionProof,
#[error("Cannot migrate a master edition used for prints")]
CannotMigrateMasterWithSupply,
#[error("Cannot migrate a print edition")]
CannotMigratePrints,
#[error("Cannot burn a collection NFT")]
CannotBurnCollection,
#[error("Plugin already exists")]
PluginAlreadyExists,
#[error("Numerical overflow")]
NumericalOverflowError,
#[error("Already compressed account")]
AlreadyCompressed,
#[error("Already decompressed account")]
AlreadyDecompressed,
#[error("Invalid Collection passed in")]
InvalidCollection,
#[error("Missing update authority")]
MissingUpdateAuthority,
#[error("Missing new owner")]
MissingNewOwner,
#[error("Missing system program")]
MissingSystemProgram,
#[error("Feature not available")]
NotAvailable,
#[error("Invalid Asset passed in")]
InvalidAsset,
#[error("Missing collection")]
MissingCollection,
#[error("Neither the asset or any plugins have approved this operation")]
NoApprovals,
#[error("Plugin Manager cannot redelegate a delegated plugin without revoking first")]
CannotRedelegate,
#[error("Invalid setting for plugin")]
InvalidPluginSetting,
#[error("Cannot specify both an update authority and collection on an asset")]
ConflictingAuthority,
#[error("Invalid Log Wrapper Program")]
InvalidLogWrapperProgram,
#[error("External PluginExternalPluginAdapter not found")]
ExternalPluginAdapterNotFound,
#[error("External PluginExternalPluginAdapter already exists")]
ExternalPluginAdapterAlreadyExists,
#[error("Missing asset needed for extra account PDA derivation")]
MissingAsset,
#[error("Missing account needed for external plugin adapter")]
MissingExternalPluginAdapterAccount,
#[error("Oracle external plugin adapter can only be configured to reject")]
OracleCanRejectOnly,
#[error("External plugin adapter must have at least one lifecycle check")]
RequiresLifecycleCheck,
#[error("Duplicate lifecycle checks were provided for external plugin adapter ")]
DuplicateLifecycleChecks,
#[error("Could not read from oracle account")]
InvalidOracleAccountData,
#[error("Oracle account is uninitialized")]
UninitializedOracleAccount,
#[error("Missing required signer for operation")]
MissingSigner,
#[error("Invalid plugin operation")]
InvalidPluginOperation,
}
impl solana_program::program_error::PrintProgramError for MplCoreError {
fn print<E>(&self) {
solana_program::msg!(&self.to_string());
}
}