From fff1631a8b28620af8519357cff7d41823d8310b Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Thu, 16 May 2019 11:32:27 -0600 Subject: [PATCH] Return a better error when a program account isn't found (#4310) --- runtime/src/accounts.rs | 4 ++-- sdk/src/transaction.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/src/accounts.rs b/runtime/src/accounts.rs index 70c672c1da..3283283470 100644 --- a/runtime/src/accounts.rs +++ b/runtime/src/accounts.rs @@ -227,7 +227,7 @@ impl Accounts { Some(program) => program, None => { error_counters.account_not_found += 1; - return Err(TransactionError::AccountNotFound); + return Err(TransactionError::ProgramAccountNotFound); } }; if !program.executable || program.owner == Pubkey::default() { @@ -1019,7 +1019,7 @@ mod tests { &Pubkey::new_rand(), &mut error_counters ), - Err(TransactionError::AccountNotFound) + Err(TransactionError::ProgramAccountNotFound) ); assert_eq!(error_counters.account_not_found, 1); } diff --git a/sdk/src/transaction.rs b/sdk/src/transaction.rs index da3ace0b7a..06b8833e04 100644 --- a/sdk/src/transaction.rs +++ b/sdk/src/transaction.rs @@ -22,6 +22,9 @@ pub enum TransactionError { /// Attempt to debit from `Pubkey`, but no found no record of a prior credit. AccountNotFound, + /// Attempt to load program from `Pubkey`, but it doesn't exist. + ProgramAccountNotFound, + /// The from `Pubkey` does not have sufficient balance to pay the fee to schedule the transaction InsufficientFundsForFee,