673a3e45d3
* distinguish authenticator errors by credential spent * nitpicking fixes * fix CI to see those changes * error naming
61 lines
1.9 KiB
Rust
61 lines
1.9 KiB
Rust
use nym_credentials_interface::TicketType;
|
|
use nym_sdk::mixnet::InputMessage;
|
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum AuthenticationClientError {
|
|
#[error("mixnet client stopped returning responses")]
|
|
NoMixnetMessagesReceived,
|
|
|
|
#[error("failed to send mixnet message")]
|
|
SendMixnetMessage(#[source] Box<tokio::sync::mpsc::error::SendError<InputMessage>>),
|
|
|
|
#[error("timeout waiting for connect response from exit gateway (authenticator)")]
|
|
TimeoutWaitingForConnectResponse,
|
|
|
|
#[error("unknown version number")]
|
|
UnknownVersion,
|
|
|
|
#[error("unsupported request version")]
|
|
UnsupportedVersion,
|
|
|
|
#[error(transparent)]
|
|
Bincode(#[from] bincode::Error),
|
|
|
|
#[error(transparent)]
|
|
AuthenticatorRequests(#[from] nym_authenticator_requests::Error),
|
|
|
|
#[error("verification failure")]
|
|
VerificationFailed(#[source] nym_authenticator_requests::Error),
|
|
|
|
#[error("failed to parse entry gateway socket addr")]
|
|
FailedToParseEntryGatewaySocketAddr(#[source] std::net::AddrParseError),
|
|
|
|
#[error("received invalid response from gateway authenticator")]
|
|
InvalidGatewayAuthResponse,
|
|
|
|
#[error("failed to get {ticketbook_type} ticket")]
|
|
GetTicket {
|
|
ticketbook_type: TicketType,
|
|
#[source]
|
|
source: nym_bandwidth_controller::error::BandwidthControllerError,
|
|
},
|
|
|
|
#[error("unknown authenticator version number")]
|
|
UnsupportedAuthenticatorVersion,
|
|
}
|
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum RegistrationError {
|
|
#[error(transparent)]
|
|
NoCredentialSent(AuthenticationClientError), // This intentionnally doesn't use `from` to avoid random ? operator to land here when they shouldn't
|
|
|
|
#[error("an error occured after a credential was sent : {source}")]
|
|
CredentialSent {
|
|
#[source]
|
|
source: AuthenticationClientError,
|
|
},
|
|
}
|
|
|
|
// Result type based on our error type
|
|
pub(crate) type Result<T> = std::result::Result<T, AuthenticationClientError>;
|