Explorar o código

add SolFailed error to error.rs

ghassmo %!s(int64=4) %!d(string=hai) anos
pai
achega
be4746324b
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      src/error.rs

+ 11 - 0
src/error.rs

@@ -44,6 +44,8 @@ pub enum Error {
     ClientFailed(String),
     #[cfg(feature = "default")]
     BtcFailed(String),
+    #[cfg(feature = "sol")]
+    SolFailed(String),
     TryIntoError,
     TryFromError,
     JsonRpcError(String),
@@ -97,6 +99,8 @@ impl fmt::Display for Error {
             Error::ClientFailed(ref err) => write!(f, "Client failed: {}", err),
             #[cfg(feature = "default")]
             Error::BtcFailed(ref err) => write!(f, "Btc client failed: {}", err),
+            #[cfg(feature = "sol")]
+            Error::SolFailed(ref err) => write!(f, "Sol client failed: {}", err),
             Error::TryIntoError => f.write_str("TryInto error"),
             Error::TryFromError => f.write_str("TryFrom error"),
             Error::RocksdbError(ref err) => write!(f, "Rocksdb Error: {}", err),
@@ -226,6 +230,13 @@ impl From<crate::service::BtcFailed> for Error {
     }
 }
 
+#[cfg(feature = "sol")]
+impl From<crate::service::SolFailed> for Error {
+    fn from(err: crate::service::SolFailed) -> Error {
+        Error::SolFailed(err.to_string())
+    }
+}
+
 impl From<surf::Error> for Error {
     fn from(err: surf::Error) -> Error {
         Error::SurfHttpError(err.to_string())