Merge InstructionError and ProgramError

From the user's perspective, it's just an instruction error.
For program-specific errors, we still have
InstructionError::CustomError.
This commit is contained in:
Greg Fitzgerald
2019-03-18 10:05:03 -06:00
parent 607b368fe3
commit 8d032aba9d
21 changed files with 170 additions and 187 deletions

View File

@@ -1,9 +1,9 @@
use bincode::serialize;
use log::*;
use solana_sdk::account::KeyedAccount;
use solana_sdk::native_program::ProgramError;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::solana_entrypoint;
use solana_sdk::transaction::InstructionError;
mod token_program;
@@ -13,11 +13,11 @@ fn entrypoint(
info: &mut [KeyedAccount],
input: &[u8],
_tick_height: u64,
) -> Result<(), ProgramError> {
) -> Result<(), InstructionError> {
solana_logger::setup();
token_program::TokenProgram::process(program_id, info, input).map_err(|e| {
error!("error: {:?}", e);
ProgramError::CustomError(serialize(&e).unwrap())
InstructionError::CustomError(serialize(&e).unwrap())
})
}