mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
added error conversion for rusqlite
This commit is contained in:
@@ -2,6 +2,7 @@ use std::fmt;
|
||||
|
||||
use crate::net::error::NetError;
|
||||
use crate::vm::ZKVMError;
|
||||
use rusqlite;
|
||||
|
||||
use async_zmq::zmq;
|
||||
|
||||
@@ -36,6 +37,7 @@ pub enum Error {
|
||||
BadContract,
|
||||
Groth16Error(bellman::SynthesisError),
|
||||
ZMQError(zmq::Error),
|
||||
RusqliteError(rusqlite::Error),
|
||||
OperationFailed,
|
||||
ConnectFailed,
|
||||
ConnectTimeout,
|
||||
@@ -80,6 +82,7 @@ impl fmt::Display for 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"),
|
||||
Error::ConnectTimeout => f.write_str("Connection timed out"),
|
||||
@@ -104,6 +107,12 @@ impl From<zmq::Error> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<rusqlite::Error> for Error {
|
||||
fn from(err: rusqlite::Error) -> Error {
|
||||
Error::RusqliteError(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ZKVMError> for Error {
|
||||
fn from(err: ZKVMError) -> Error {
|
||||
Error::VMError(err)
|
||||
|
||||
Reference in New Issue
Block a user