Files
nym/nym-credential-proxy/vpn-api-lib-wasm/src/error.rs
T
2024-10-16 22:23:53 +02:00

36 lines
946 B
Rust

// Copyright 2024 Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: GPL-3.0-only
use serde_wasm_bindgen::Error;
use thiserror::Error;
use wasm_utils::wasm_error;
#[derive(Debug, Error)]
pub enum VpnApiLibError {
#[error("{0}")]
Json(String),
#[error("[ecash] cryptographic failure: {source}")]
EcashFailure {
#[from]
source: nym_compact_ecash::CompactEcashError,
},
#[error("provided invalid ticket type")]
MalformedTicketType,
#[error("the provided shares and issuers are not from the same epoch! {shares} and {issuers}")]
InconsistentEpochId { shares: u64, issuers: u64 },
#[error("failed to recover ed25519 private key from its base58 representation")]
MalformedEd25519Key,
}
wasm_error!(VpnApiLibError);
impl From<serde_wasm_bindgen::Error> for VpnApiLibError {
fn from(value: Error) -> Self {
VpnApiLibError::Json(value.to_string())
}
}