mirror of
https://github.com/jwinterm/mwixnet.git
synced 2026-10-22 00:28:33 +02:00
removing error.rs and failure crate
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
use failure::{self, Context, Fail};
|
||||
use std::fmt::{self, Display};
|
||||
|
||||
/// MWixnet error definition
|
||||
#[derive(Debug)]
|
||||
pub struct Error {
|
||||
inner: Context<ErrorKind>,
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// MWixnet error types
|
||||
#[derive(Debug, Fail)]
|
||||
pub enum ErrorKind {
|
||||
/// Wallet error
|
||||
#[fail(display = "wallet error: {}", _0)]
|
||||
WalletError(crate::wallet::WalletError),
|
||||
/// Wallet error
|
||||
#[fail(display = "node error: {}", _0)]
|
||||
NodeError(crate::node::NodeError),
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {}
|
||||
|
||||
impl Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
Display::fmt(&self.inner, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::wallet::WalletError> for Error {
|
||||
fn from(e: crate::wallet::WalletError) -> Error {
|
||||
Error {
|
||||
inner: Context::new(ErrorKind::WalletError(e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::node::NodeError> for Error {
|
||||
fn from(e: crate::node::NodeError) -> Error {
|
||||
Error {
|
||||
inner: Context::new(ErrorKind::NodeError(e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ use tokio::runtime::Runtime;
|
||||
extern crate clap;
|
||||
|
||||
mod config;
|
||||
mod error;
|
||||
mod node;
|
||||
mod onion;
|
||||
mod rpc;
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ pub trait Server: Send + Sync {
|
||||
/// and assemble the coinswap transaction, posting the transaction to the configured node.
|
||||
///
|
||||
/// Currently only a single mix node is used. Milestone 3 will include support for multiple mix nodes.
|
||||
fn execute_round(&self) -> crate::error::Result<()>;
|
||||
fn execute_round(&self) -> Result<(), Box<dyn std::error::Error>>;
|
||||
}
|
||||
|
||||
/// The standard MWixnet server implementation
|
||||
@@ -168,7 +168,7 @@ impl Server for ServerImpl {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn execute_round(&self) -> crate::error::Result<()> {
|
||||
fn execute_round(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut locked_state = self.submissions.lock().unwrap();
|
||||
let next_block_height = self.node.get_chain_height()? + 1;
|
||||
|
||||
@@ -258,7 +258,7 @@ pub mod mock {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn execute_round(&self) -> crate::error::Result<()> {
|
||||
fn execute_round(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user