mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
add Base58EncodeError and Base58DecodeError to error.rs
This commit is contained in:
16
src/error.rs
16
src/error.rs
@@ -50,6 +50,8 @@ pub enum Error {
|
||||
TomlDeserializeError(String),
|
||||
TomlSerializeError(String),
|
||||
CashierNoReply,
|
||||
Base58EncodeError(String),
|
||||
Base58DecodeError(String),
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {}
|
||||
@@ -97,6 +99,8 @@ impl fmt::Display for Error {
|
||||
Error::EmptyPassword => f.write_str("Password is empty. Cannot create database"),
|
||||
Error::TomlDeserializeError(ref err) => write!(f, "Toml parsing error: {}", err),
|
||||
Error::TomlSerializeError(ref err) => write!(f, "Toml parsing error: {}", err),
|
||||
Error::Base58EncodeError(ref err) => write!(f, "bs58 encode error: {}", err),
|
||||
Error::Base58DecodeError(ref err) => write!(f, "bs58 decode error: {}", err),
|
||||
Error::CashierNoReply => f.write_str("Cashier did not reply with BTC address"),
|
||||
}
|
||||
}
|
||||
@@ -216,3 +220,15 @@ impl From<toml::ser::Error> for Error {
|
||||
Error::TomlSerializeError(err.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bs58::encode::Error> for Error {
|
||||
fn from(err: bs58::encode::Error) -> Error {
|
||||
Error::Base58EncodeError(err.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bs58::decode::Error> for Error {
|
||||
fn from(err: bs58::decode::Error) -> Error {
|
||||
Error::Base58DecodeError(err.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user