More custom error rename (#9227)

automerge
This commit is contained in:
Jack May 2020-04-01 11:13:31 -07:00 committed by GitHub
parent 492b7d5ef9
commit 9aab0b9388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -537,7 +537,7 @@ impl CliConfig<'_> {
if !self.signers.is_empty() { if !self.signers.is_empty() {
self.signers[0].try_pubkey() self.signers[0].try_pubkey()
} else { } else {
Err(SignerError::CustomError( Err(SignerError::Custom(
"Default keypair must be set if pubkey arg not provided".to_string(), "Default keypair must be set if pubkey arg not provided".to_string(),
)) ))
} }

View File

@ -60,16 +60,16 @@ impl From<hidapi::HidError> for RemoteWalletError {
impl From<RemoteWalletError> for SignerError { impl From<RemoteWalletError> for SignerError {
fn from(err: RemoteWalletError) -> SignerError { fn from(err: RemoteWalletError) -> SignerError {
match err { match err {
RemoteWalletError::Hid(hid_error) => SignerError::ConnectionError(hid_error), RemoteWalletError::Hid(hid_error) => SignerError::Connection(hid_error),
RemoteWalletError::DeviceTypeMismatch => SignerError::ConnectionError(err.to_string()), RemoteWalletError::DeviceTypeMismatch => SignerError::Connection(err.to_string()),
RemoteWalletError::InvalidDevice => SignerError::ConnectionError(err.to_string()), RemoteWalletError::InvalidDevice => SignerError::Connection(err.to_string()),
RemoteWalletError::InvalidInput(input) => SignerError::InvalidInput(input), RemoteWalletError::InvalidInput(input) => SignerError::InvalidInput(input),
RemoteWalletError::NoDeviceFound => SignerError::NoDeviceFound, RemoteWalletError::NoDeviceFound => SignerError::NoDeviceFound,
RemoteWalletError::Protocol(e) => SignerError::Protocol(e.to_string()), RemoteWalletError::Protocol(e) => SignerError::Protocol(e.to_string()),
RemoteWalletError::UserCancel => { RemoteWalletError::UserCancel => {
SignerError::UserCancel("remote wallet operation rejected by the user".to_string()) SignerError::UserCancel("remote wallet operation rejected by the user".to_string())
} }
_ => SignerError::CustomError(err.to_string()), _ => SignerError::Custom(err.to_string()),
} }
} }
} }

View File

@ -202,7 +202,7 @@ pub enum SignerError {
TransactionError(#[from] TransactionError), TransactionError(#[from] TransactionError),
#[error("custom error: {0}")] #[error("custom error: {0}")]
CustomError(String), Custom(String),
// Presigner-specific Errors // Presigner-specific Errors
#[error("presigner error")] #[error("presigner error")]
@ -210,7 +210,7 @@ pub enum SignerError {
// Remote Keypair-specific Errors // Remote Keypair-specific Errors
#[error("connection error: {0}")] #[error("connection error: {0}")]
ConnectionError(String), Connection(String),
#[error("invalid input: {0}")] #[error("invalid input: {0}")]
InvalidInput(String), InvalidInput(String),