|
|
@@ -2,10 +2,9 @@ use std::fmt;
|
|
|
|
|
|
use crate::net::error::NetError;
|
|
|
use crate::vm::ZKVMError;
|
|
|
+use crate::service::ServicesError;
|
|
|
use rusqlite;
|
|
|
|
|
|
-use zeromq;
|
|
|
-
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
@@ -36,7 +35,6 @@ pub enum Error {
|
|
|
VMError(ZKVMError),
|
|
|
BadContract,
|
|
|
Groth16Error(bellman::SynthesisError),
|
|
|
- ZMQError(zeromq::ZmqError),
|
|
|
RusqliteError(rusqlite::Error),
|
|
|
OperationFailed,
|
|
|
ConnectFailed,
|
|
|
@@ -46,6 +44,8 @@ pub enum Error {
|
|
|
ServiceStopped,
|
|
|
Utf8Error,
|
|
|
NoteDecryptionFailed,
|
|
|
+ ServicesError(ServicesError),
|
|
|
+ ZMQError(zeromq::ZmqError)
|
|
|
}
|
|
|
|
|
|
impl std::error::Error for Error {}
|
|
|
@@ -81,7 +81,6 @@ impl fmt::Display for Error {
|
|
|
Error::VMError(_) => f.write_str("VM error"),
|
|
|
Error::BadContract => f.write_str("Contract is poorly defined"),
|
|
|
Error::Groth16Error(ref err) => write!(f, "groth16 error: {}", err),
|
|
|
- Error::ZMQError(ref err) => write!(f, "ZMQ error: {}", err),
|
|
|
Error::RusqliteError(ref err) => write!(f, "Rusqlite error: {}", err),
|
|
|
Error::OperationFailed => f.write_str("Operation failed"),
|
|
|
Error::ConnectFailed => f.write_str("Connection failed"),
|
|
|
@@ -91,13 +90,16 @@ impl fmt::Display for Error {
|
|
|
Error::ServiceStopped => f.write_str("Service stopped"),
|
|
|
Error::Utf8Error => f.write_str("Malformed UTF8"),
|
|
|
Error::NoteDecryptionFailed => f.write_str("Unable to decrypt mint note"),
|
|
|
+ Error::ServicesError(ref err) => write!(f, "Services error: {}", err),
|
|
|
+ Error::ZMQError(ref err) => write!(f, "zmq error: {}", err),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-impl From<std::io::Error> for Error {
|
|
|
- fn from(err: std::io::Error) -> Error {
|
|
|
- Error::Io(err)
|
|
|
+
|
|
|
+impl From<ServicesError> for Error {
|
|
|
+ fn from(err: ServicesError) -> Error {
|
|
|
+ Error::ServicesError(err)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -107,6 +109,13 @@ impl From<zeromq::ZmqError> for Error {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+impl From<std::io::Error> for Error {
|
|
|
+ fn from(err: std::io::Error) -> Error {
|
|
|
+ Error::Io(err)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
impl From<rusqlite::Error> for Error {
|
|
|
fn from(err: rusqlite::Error) -> Error {
|
|
|
Error::RusqliteError(err)
|