Files
nym/wasm/client/src/error.rs
T
Jędrzej Stuczyński 4890c528bc feat: mixFetch - the final countdown (#3737)
* mixFetch

* clippy

* removed redundant Arc over 'WasmStorage' in the 'ClientStorage'

---------

Co-authored-by: Fouad <fmtabbara@hotmail.co.uk>
2023-09-07 12:45:03 +01:00

52 lines
1.3 KiB
Rust

// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use js_sys::Promise;
use thiserror::Error;
use wasm_client_core::error::WasmCoreError;
use wasm_client_core::topology::WasmTopologyError;
use wasm_client_core::ClientCoreError;
use wasm_utils::wasm_error;
#[cfg(feature = "node-tester")]
use nym_node_tester_utils::error::NetworkTestingError;
#[derive(Debug, Error)]
pub enum WasmClientError {
#[error(transparent)]
CoreError {
#[from]
source: WasmCoreError,
},
#[error("failed to parse mix config options: {source}")]
MalformedConfigOptions {
#[from]
source: serde_wasm_bindgen::Error,
},
#[error("provided topology was malformed: {source}")]
InvalidTopology {
#[from]
source: WasmTopologyError,
},
#[cfg(feature = "node-tester")]
#[error("failed to test the node: {source}")]
NodeTestingFailure {
#[from]
source: NetworkTestingError,
},
}
// I dislike this so much - there must be a better way.
impl From<ClientCoreError> for WasmClientError {
fn from(value: ClientCoreError) -> Self {
WasmClientError::CoreError {
source: WasmCoreError::BaseClientError { source: value },
}
}
}
wasm_error!(WasmClientError);