1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Error types used in SEEC.
use remoc::rch::base;
use std::io;

use crate::utils::BoxError;
use thiserror::Error;

#[derive(Error, Debug)]
pub enum ExecutorError {
    #[error("Received out of order message during execution")]
    OutOfOrderMessage,
    #[error("Unable to perform function dependent setup")]
    Setup(#[source] BoxError),
    #[error("Circuit is malformed and not executable")]
    IllegalCircuit,
}

#[derive(Error, Debug)]
pub enum CircuitError {
    #[error("Unable to save circuit as dot file")]
    SaveAsDot(#[source] io::Error),
    #[error("Unable to load bristol file")]
    LoadBristol(#[from] BristolError),
    #[error("Unable to convert bristol circuit")]
    ConversionError,
}

#[derive(Debug, Error)]
pub enum BristolError {
    #[error("Unable to read bristol file")]
    ReadFailed(#[from] io::Error),
    #[error("Unable to parse bristol file")]
    ParseFailed(#[from] nom::Err<nom::error::Error<String>>),
}

#[derive(Debug, Error)]
pub enum MTProviderError<Request> {
    #[error("Sending MT request failed")]
    RequestFailed(#[from] base::SendError<Request>),
    #[error("Receiving MTs failed")]
    ReceiveFailed(#[from] base::RecvError),
    #[error("Remote unexpectedly closed")]
    RemoteClosed,
    #[error("Received illegal message from provided")]
    IllegalMessage,
}