lang: Log errors on exit (#194)

This commit is contained in:
Armani Ferrante 2021-04-14 09:52:14 +08:00 committed by GitHub
parent 318eb520d4
commit a1aa705c64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 4 deletions

View File

@ -475,7 +475,10 @@ pub fn generate_non_inlined_handlers(program: &Program) -> proc_macro2::TokenStr
remaining_accounts,
),
#(#ctor_untyped_args),*
)?;
).map_err(|e| {
anchor_lang::solana_program::msg!(&e.to_string());
e
})?;
// Create the solana account for the ctor data.
let from = ctor_accounts.from.key;
@ -572,7 +575,10 @@ pub fn generate_non_inlined_handlers(program: &Program) -> proc_macro2::TokenStr
state.#ix_name(
ctx,
#(#ix_arg_names),*
)?;
).map_err(|e| {
anchor_lang::solana_program::msg!(&e.to_string());
e
})?;
// Serialize the state and save it to storage.
accounts.exit(program_id)?;
@ -648,7 +654,10 @@ pub fn generate_non_inlined_handlers(program: &Program) -> proc_macro2::TokenStr
state.#ix_name(
ctx,
#(#ix_arg_names),*
)?;
).map_err(|e| {
anchor_lang::solana_program::msg!(&e.to_string());
e
})?;
// Serialize the state and save it to storage.
accounts.exit(program_id)?;
@ -677,7 +686,10 @@ pub fn generate_non_inlined_handlers(program: &Program) -> proc_macro2::TokenStr
#state_name::#ix_name(
Context::new(program_id, &mut accounts, remaining_accounts),
#(#ix_arg_names),*
)?;
).map_err(|e| {
anchor_lang::solana_program::msg!(&e.to_string());
e
})?;
accounts.exit(program_id)
}
}