Return a better error when a program account isn't found (#4310)
This commit is contained in:
@ -227,7 +227,7 @@ impl Accounts {
|
|||||||
Some(program) => program,
|
Some(program) => program,
|
||||||
None => {
|
None => {
|
||||||
error_counters.account_not_found += 1;
|
error_counters.account_not_found += 1;
|
||||||
return Err(TransactionError::AccountNotFound);
|
return Err(TransactionError::ProgramAccountNotFound);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if !program.executable || program.owner == Pubkey::default() {
|
if !program.executable || program.owner == Pubkey::default() {
|
||||||
@ -1019,7 +1019,7 @@ mod tests {
|
|||||||
&Pubkey::new_rand(),
|
&Pubkey::new_rand(),
|
||||||
&mut error_counters
|
&mut error_counters
|
||||||
),
|
),
|
||||||
Err(TransactionError::AccountNotFound)
|
Err(TransactionError::ProgramAccountNotFound)
|
||||||
);
|
);
|
||||||
assert_eq!(error_counters.account_not_found, 1);
|
assert_eq!(error_counters.account_not_found, 1);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,9 @@ pub enum TransactionError {
|
|||||||
/// Attempt to debit from `Pubkey`, but no found no record of a prior credit.
|
/// Attempt to debit from `Pubkey`, but no found no record of a prior credit.
|
||||||
AccountNotFound,
|
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
|
/// The from `Pubkey` does not have sufficient balance to pay the fee to schedule the transaction
|
||||||
InsufficientFundsForFee,
|
InsufficientFundsForFee,
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user