use nym_validator_client::nym_api::error::NymAPIError;
use nym_validator_client::nyxd::error::NyxdError;
use std::net::SocketAddr;
#[derive(thiserror::Error, Debug)]
pub enum SessionError {
#[error("nyxd chain client error: {0}")]
Nyxd(#[from] NyxdError),
#[error("nym-api error: {0}")]
Api(#[from] NymAPIError),
#[error("network details contain no usable {which} endpoint")]
MissingEndpoint { which: &'static str },
#[error("invalid {which} url {url}: {source}")]
InvalidUrl {
which: &'static str,
url: String,
#[source]
source: url::ParseError,
},
#[error("credential storage error: {0}")]
Storage(String),
#[error("ticketbook issuance error: {0}")]
Issuance(String),
#[error(
"provisioning timed out after {after:?} — the ecash signers are likely unresponsive; \
any deposit already made is recoverable from the pending-request store on retry"
)]
ProvisioningTimeout { after: std::time::Duration },
#[error("no gateway found with identity {0}")]
GatewayNotFound(String),
#[error("no WireGuard-capable gateway available for the requested role")]
NoWireguardGateway,
#[error("no WireGuard-capable gateway found in country {0}")]
NoCountryMatch(String),
#[error("no QUIC-bridge gateway available for selection: {spec}")]
NoQuicGateway { spec: String },
#[error("entry and exit resolved to the same gateway ({0}); a two-hop tunnel needs distinct gateways")]
SameGatewaySelected(String),
#[error("gateway {identity} advertised malformed LP data: {reason}")]
MalformedGateway { identity: String, reason: String },
#[error("registration with gateway at {address} failed: {source}")]
Registration {
address: SocketAddr,
#[source]
source: nym_registration_client::LpClientError,
},
#[error("session setup was cancelled")]
Cancelled,
}