Rename IOError to BorshIoError
This commit is contained in:
@ -72,7 +72,7 @@ pub fn to_instruction_error(error: ProgramError) -> InstructionError {
|
|||||||
ProgramError::AccountBorrowFailed => InstructionError::AccountBorrowFailed,
|
ProgramError::AccountBorrowFailed => InstructionError::AccountBorrowFailed,
|
||||||
ProgramError::MaxSeedLengthExceeded => InstructionError::MaxSeedLengthExceeded,
|
ProgramError::MaxSeedLengthExceeded => InstructionError::MaxSeedLengthExceeded,
|
||||||
ProgramError::InvalidSeeds => InstructionError::InvalidSeeds,
|
ProgramError::InvalidSeeds => InstructionError::InvalidSeeds,
|
||||||
ProgramError::IOError(err) => InstructionError::IOError(err),
|
ProgramError::BorshIoError(err) => InstructionError::BorshIoError(err),
|
||||||
ProgramError::AccountNotRentExempt => InstructionError::AccountNotRentExempt,
|
ProgramError::AccountNotRentExempt => InstructionError::AccountNotRentExempt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ pub enum InstructionError {
|
|||||||
IncorrectAuthority,
|
IncorrectAuthority,
|
||||||
|
|
||||||
#[error("Failed to serialize or deserialize account data: {0}")]
|
#[error("Failed to serialize or deserialize account data: {0}")]
|
||||||
IOError(String),
|
BorshIoError(String),
|
||||||
|
|
||||||
#[error("An account does not have enough lamports to be rent-exempt")]
|
#[error("An account does not have enough lamports to be rent-exempt")]
|
||||||
AccountNotRentExempt,
|
AccountNotRentExempt,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::{decode_error::DecodeError, instruction::InstructionError, msg, pubkey::PubkeyError};
|
use crate::{decode_error::DecodeError, instruction::InstructionError, msg, pubkey::PubkeyError};
|
||||||
use borsh::maybestd::io::Error as IOError;
|
use borsh::maybestd::io::Error as BorshIoError;
|
||||||
use num_traits::{FromPrimitive, ToPrimitive};
|
use num_traits::{FromPrimitive, ToPrimitive};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
@ -39,7 +39,7 @@ pub enum ProgramError {
|
|||||||
#[error("Provided seeds do not result in a valid address")]
|
#[error("Provided seeds do not result in a valid address")]
|
||||||
InvalidSeeds,
|
InvalidSeeds,
|
||||||
#[error("IO Error: {0}")]
|
#[error("IO Error: {0}")]
|
||||||
IOError(String),
|
BorshIoError(String),
|
||||||
#[error("An account does not have enough lamports to be rent-exempt")]
|
#[error("An account does not have enough lamports to be rent-exempt")]
|
||||||
AccountNotRentExempt,
|
AccountNotRentExempt,
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ impl PrintProgramError for ProgramError {
|
|||||||
Self::AccountBorrowFailed => msg!("Error: AccountBorrowFailed"),
|
Self::AccountBorrowFailed => msg!("Error: AccountBorrowFailed"),
|
||||||
Self::MaxSeedLengthExceeded => msg!("Error: MaxSeedLengthExceeded"),
|
Self::MaxSeedLengthExceeded => msg!("Error: MaxSeedLengthExceeded"),
|
||||||
Self::InvalidSeeds => msg!("Error: InvalidSeeds"),
|
Self::InvalidSeeds => msg!("Error: InvalidSeeds"),
|
||||||
Self::IOError(_) => msg!("Error: IOError"),
|
Self::BorshIoError(_) => msg!("Error: BorshIoError"),
|
||||||
Self::AccountNotRentExempt => msg!("Error: AccountNotRentExempt"),
|
Self::AccountNotRentExempt => msg!("Error: AccountNotRentExempt"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ pub const NOT_ENOUGH_ACCOUNT_KEYS: u64 = to_builtin!(11);
|
|||||||
pub const ACCOUNT_BORROW_FAILED: u64 = to_builtin!(12);
|
pub const ACCOUNT_BORROW_FAILED: u64 = to_builtin!(12);
|
||||||
pub const MAX_SEED_LENGTH_EXCEEDED: u64 = to_builtin!(13);
|
pub const MAX_SEED_LENGTH_EXCEEDED: u64 = to_builtin!(13);
|
||||||
pub const INVALID_SEEDS: u64 = to_builtin!(14);
|
pub const INVALID_SEEDS: u64 = to_builtin!(14);
|
||||||
pub const IO_ERROR: u64 = to_builtin!(15);
|
pub const BORSH_IO_ERROR: u64 = to_builtin!(15);
|
||||||
pub const ACCOUNT_NOT_RENT_EXEMPT: u64 = to_builtin!(16);
|
pub const ACCOUNT_NOT_RENT_EXEMPT: u64 = to_builtin!(16);
|
||||||
|
|
||||||
impl From<ProgramError> for u64 {
|
impl From<ProgramError> for u64 {
|
||||||
@ -123,7 +123,7 @@ impl From<ProgramError> for u64 {
|
|||||||
ProgramError::AccountBorrowFailed => ACCOUNT_BORROW_FAILED,
|
ProgramError::AccountBorrowFailed => ACCOUNT_BORROW_FAILED,
|
||||||
ProgramError::MaxSeedLengthExceeded => MAX_SEED_LENGTH_EXCEEDED,
|
ProgramError::MaxSeedLengthExceeded => MAX_SEED_LENGTH_EXCEEDED,
|
||||||
ProgramError::InvalidSeeds => INVALID_SEEDS,
|
ProgramError::InvalidSeeds => INVALID_SEEDS,
|
||||||
ProgramError::IOError(_) => IO_ERROR,
|
ProgramError::BorshIoError(_) => BORSH_IO_ERROR,
|
||||||
ProgramError::AccountNotRentExempt => ACCOUNT_NOT_RENT_EXEMPT,
|
ProgramError::AccountNotRentExempt => ACCOUNT_NOT_RENT_EXEMPT,
|
||||||
|
|
||||||
ProgramError::Custom(error) => {
|
ProgramError::Custom(error) => {
|
||||||
@ -177,7 +177,7 @@ impl TryFrom<InstructionError> for ProgramError {
|
|||||||
Self::Error::NotEnoughAccountKeys => Ok(Self::NotEnoughAccountKeys),
|
Self::Error::NotEnoughAccountKeys => Ok(Self::NotEnoughAccountKeys),
|
||||||
Self::Error::AccountBorrowFailed => Ok(Self::AccountBorrowFailed),
|
Self::Error::AccountBorrowFailed => Ok(Self::AccountBorrowFailed),
|
||||||
Self::Error::MaxSeedLengthExceeded => Ok(Self::MaxSeedLengthExceeded),
|
Self::Error::MaxSeedLengthExceeded => Ok(Self::MaxSeedLengthExceeded),
|
||||||
Self::Error::IOError(err) => Ok(Self::IOError(err)),
|
Self::Error::BorshIoError(err) => Ok(Self::BorshIoError(err)),
|
||||||
Self::Error::AccountNotRentExempt => Ok(Self::AccountNotRentExempt),
|
Self::Error::AccountNotRentExempt => Ok(Self::AccountNotRentExempt),
|
||||||
_ => Err(error),
|
_ => Err(error),
|
||||||
}
|
}
|
||||||
@ -226,8 +226,8 @@ impl From<PubkeyError> for ProgramError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<IOError> for ProgramError {
|
impl From<BorshIoError> for ProgramError {
|
||||||
fn from(error: IOError) -> Self {
|
fn from(error: BorshIoError) -> Self {
|
||||||
ProgramError::IOError(format!("{}", error))
|
ProgramError::BorshIoError(format!("{}", error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,6 @@ pub enum InstructionErrorType {
|
|||||||
ProgramFailedToCompile = 41,
|
ProgramFailedToCompile = 41,
|
||||||
Immutable = 42,
|
Immutable = 42,
|
||||||
IncorrectAuthority = 43,
|
IncorrectAuthority = 43,
|
||||||
IOError = 44,
|
BorshIoError = 44,
|
||||||
AccountNotRentExempt = 45,
|
AccountNotRentExempt = 45,
|
||||||
}
|
}
|
||||||
|
@ -700,8 +700,8 @@ impl From<TransactionError> for tx_by_addr::TransactionError {
|
|||||||
InstructionError::IncorrectAuthority => {
|
InstructionError::IncorrectAuthority => {
|
||||||
tx_by_addr::InstructionErrorType::IncorrectAuthority
|
tx_by_addr::InstructionErrorType::IncorrectAuthority
|
||||||
}
|
}
|
||||||
InstructionError::IOError(_) => {
|
InstructionError::BorshIoError(_) => {
|
||||||
tx_by_addr::InstructionErrorType::IOError
|
tx_by_addr::InstructionErrorType::BorshIoError
|
||||||
}
|
}
|
||||||
InstructionError::AccountNotRentExempt => {
|
InstructionError::AccountNotRentExempt => {
|
||||||
tx_by_addr::InstructionErrorType::AccountNotRentExempt
|
tx_by_addr::InstructionErrorType::AccountNotRentExempt
|
||||||
|
@ -93,6 +93,8 @@ enum InstructionErrorType {
|
|||||||
PROGRAM_FAILED_TO_COMPILE = 41;
|
PROGRAM_FAILED_TO_COMPILE = 41;
|
||||||
IMMUTABLE = 42;
|
IMMUTABLE = 42;
|
||||||
INCORRECT_AUTHORITY = 43;
|
INCORRECT_AUTHORITY = 43;
|
||||||
|
BORSH_IO_ERROR = 44;
|
||||||
|
ACCOUNT_NOT_RENT_EXEMPT = 45;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UnixTimestamp {
|
message UnixTimestamp {
|
||||||
|
Reference in New Issue
Block a user