Skip to main content

dynamic_waas_sdk_mpc/
error.rs

1//! Error type for MPC operations.
2
3use thiserror::Error;
4
5#[derive(Debug, Error)]
6#[non_exhaustive]
7pub enum MpcError {
8    #[error("MPC operation failed: {0}")]
9    Operation(String),
10
11    #[error("invalid argument: {0}")]
12    InvalidArgument(String),
13
14    #[error("operation not yet implemented in this build of dynamic-waas-sdk-mpc")]
15    NotImplemented,
16
17    #[error("unexpected MPC error")]
18    Unknown,
19}
20
21/// Error codes mirrored from the C-ABI; see
22/// `tools/build-prebuilt-mpc-lib/src/lib.rs::error_codes`.
23pub(crate) mod codes {
24    pub const OK: i32 = 0;
25    pub const NOT_IMPLEMENTED: i32 = -1;
26    pub const INVALID_ARGUMENT: i32 = -2;
27    pub const MPC_FAILED: i32 = -3;
28}