@ -14,7 +14,7 @@ pub enum ProgramError {
|
|||||||
/// Allows on-chain programs to implement program-specific error types and see them returned
|
/// Allows on-chain programs to implement program-specific error types and see them returned
|
||||||
/// by the Solana runtime. A program-specific error may be any type that is represented as
|
/// by the Solana runtime. A program-specific error may be any type that is represented as
|
||||||
/// or serialized to a u32 integer.
|
/// or serialized to a u32 integer.
|
||||||
#[error("Custom program error: {0}")]
|
#[error("Custom program error: {0:#x}")]
|
||||||
Custom(u32),
|
Custom(u32),
|
||||||
#[error("The arguments provided to a program instruction where invalid")]
|
#[error("The arguments provided to a program instruction where invalid")]
|
||||||
InvalidArgument,
|
InvalidArgument,
|
||||||
@ -52,7 +52,7 @@ impl PrintProgramError for ProgramError {
|
|||||||
E: 'static + std::error::Error + DecodeError<E> + PrintProgramError + FromPrimitive,
|
E: 'static + std::error::Error + DecodeError<E> + PrintProgramError + FromPrimitive,
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
ProgramError::Custom(error) => {
|
Self::Custom(error) => {
|
||||||
if let Some(custom_error) = E::decode_custom_error_to_enum(*error) {
|
if let Some(custom_error) = E::decode_custom_error_to_enum(*error) {
|
||||||
custom_error.print::<E>();
|
custom_error.print::<E>();
|
||||||
} else {
|
} else {
|
||||||
@ -186,7 +186,7 @@ where
|
|||||||
if error >> BUILTIN_BIT_SHIFT == 0 {
|
if error >> BUILTIN_BIT_SHIFT == 0 {
|
||||||
InstructionError::Custom(error as u32)
|
InstructionError::Custom(error as u32)
|
||||||
} else {
|
} else {
|
||||||
InstructionError::InvalidError
|
Self::InvalidError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user