mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-16 15:10:20 +00:00
error macro
This commit is contained in:
@@ -78,10 +78,13 @@ macro_rules! account {
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! instruction {
|
||||
macro_rules! error {
|
||||
($struct_name:ident) => {
|
||||
$crate::impl_to_bytes!($struct_name);
|
||||
$crate::impl_instruction_from_bytes!($struct_name);
|
||||
impl From<$struct_name> for solana_program::program_error::ProgramError {
|
||||
fn from(e: $struct_name) -> Self {
|
||||
solana_program::program_error::ProgramError::Custom(e as u32)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -92,3 +95,11 @@ macro_rules! event {
|
||||
$crate::impl_from_bytes!($struct_name);
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! instruction {
|
||||
($struct_name:ident) => {
|
||||
$crate::impl_to_bytes!($struct_name);
|
||||
$crate::impl_instruction_from_bytes!($struct_name);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user