SDK: update error variants in `Feature::from_account_info` (#33750)

This commit is contained in:
Joe C 2023-10-20 07:35:22 +02:00 committed by GitHub
parent 37d093a30e
commit 6b1e9b8974
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -30,9 +30,10 @@ impl Feature {
pub fn from_account_info(account_info: &AccountInfo) -> Result<Self, ProgramError> {
if *account_info.owner != id() {
return Err(ProgramError::InvalidArgument);
return Err(ProgramError::InvalidAccountOwner);
}
bincode::deserialize(&account_info.data.borrow()).map_err(|_| ProgramError::InvalidArgument)
bincode::deserialize(&account_info.data.borrow())
.map_err(|_| ProgramError::InvalidAccountData)
}
}