|
|
@@ -38,6 +38,7 @@ pub enum Error {
|
|
|
ZMQError(String),
|
|
|
VerifyFailed,
|
|
|
TryIntoError,
|
|
|
+ RocksdbError(String),
|
|
|
}
|
|
|
|
|
|
impl std::error::Error for Error {}
|
|
|
@@ -73,10 +74,13 @@ impl fmt::Display for Error {
|
|
|
Error::ZMQError(ref err) => write!(f, "ZMQError: {}", err),
|
|
|
Error::VerifyFailed => f.write_str("Verify failed"),
|
|
|
Error::TryIntoError => f.write_str("TryInto get an error"),
|
|
|
+ Error::RocksdbError(ref err) => write!(f, "Rocksdb Error: {}", err)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
// TODO: Match statement to parse external errors into strings.
|
|
|
impl From<zeromq::ZmqError> for Error {
|
|
|
fn from(err: zeromq::ZmqError) -> Error {
|
|
|
@@ -84,6 +88,12 @@ impl From<zeromq::ZmqError> for Error {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+impl From<rocksdb::Error> for Error {
|
|
|
+ fn from(err: rocksdb::Error) -> Error {
|
|
|
+ Error::RocksdbError(err.to_string())
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
impl From<std::io::Error> for Error {
|
|
|
fn from(err: std::io::Error) -> Error {
|
|
|
Error::Io(err.kind())
|