Struct NetworkError
pub struct NetworkError(/* private fields */);Expand description
The single error type used across the entire Citadel workspace.
Pointer-sized (8 bytes): the payload is boxed so Result<T, NetworkError> stays lean on the
common Ok path. Construct via the [crate::error!] macro. Derefs to [NetworkErrorInner], so
err.code works directly.
Implementations§
§impl NetworkError
impl NetworkError
pub fn generic(msg: impl ErrorArgs) -> NetworkError
pub fn generic(msg: impl ErrorArgs) -> NetworkError
A generic, uncategorized error. Prefer a specific [ErrorCode].
pub fn msg(msg: impl ErrorArgs) -> NetworkError
pub fn msg(msg: impl ErrorArgs) -> NetworkError
Alias of NetworkError::generic.
pub fn socket(msg: impl ErrorArgs) -> NetworkError
pub fn socket(msg: impl ErrorArgs) -> NetworkError
A low-level socket error.
pub fn timeout(value: u64) -> NetworkError
pub fn timeout(value: u64) -> NetworkError
An operation timed out (value is the elapsed/limit or subject).
pub fn invalid_packet(msg: impl ErrorArgs) -> NetworkError
pub fn invalid_packet(msg: impl ErrorArgs) -> NetworkError
A received packet failed structural validation.
pub fn invalid_packet_size(size: usize) -> NetworkError
pub fn invalid_packet_size(size: usize) -> NetworkError
A packet’s size was rejected.
pub fn invalid_request(msg: impl ErrorArgs) -> NetworkError
pub fn invalid_request(msg: impl ErrorArgs) -> NetworkError
A request was malformed or not permitted in the current state.
pub fn internal(msg: impl ErrorArgs) -> NetworkError
pub fn internal(msg: impl ErrorArgs) -> NetworkError
An internal protocol invariant was violated.
pub fn node_remote_send(reason: impl ErrorArgs) -> NetworkError
pub fn node_remote_send(reason: impl ErrorArgs) -> NetworkError
Failed to hand a request to the node’s remote.
pub fn proper_shutdown() -> NetworkError
pub fn proper_shutdown() -> NetworkError
The session shut down cleanly.
pub fn io(msg: impl ErrorArgs) -> NetworkError
pub fn io(msg: impl ErrorArgs) -> NetworkError
A wrapped I/O error described by msg.
pub fn encrypt(msg: impl ErrorArgs) -> NetworkError
pub fn encrypt(msg: impl ErrorArgs) -> NetworkError
Encryption failed (with context).
pub fn decrypt(msg: impl ErrorArgs) -> NetworkError
pub fn decrypt(msg: impl ErrorArgs) -> NetworkError
Decryption failed (with context).
pub fn rekey_update(msg: impl ErrorArgs) -> NetworkError
pub fn rekey_update(msg: impl ErrorArgs) -> NetworkError
A rekey/ratchet-update step failed.
pub fn ratchet(msg: impl ErrorArgs) -> NetworkError
pub fn ratchet(msg: impl ErrorArgs) -> NetworkError
A ratchet operation failed.
pub fn out_of_bounds() -> NetworkError
pub fn out_of_bounds() -> NetworkError
An index/length was outside the valid range.
pub fn bad_security_setting() -> NetworkError
pub fn bad_security_setting() -> NetworkError
The requested security setting was invalid or unsupported.
pub fn fatal_crypt(msg: impl ErrorArgs) -> NetworkError
pub fn fatal_crypt(msg: impl ErrorArgs) -> NetworkError
An unrecoverable cryptographic fault.
The shared secret has not been loaded yet.
pub fn encryption_failure() -> NetworkError
pub fn encryption_failure() -> NetworkError
A generic encryption failure (no further context).
pub fn decryption_failure() -> NetworkError
pub fn decryption_failure() -> NetworkError
A generic decryption failure (no further context).
pub fn invalid_length() -> NetworkError
pub fn invalid_length() -> NetworkError
A buffer/key length was invalid.
pub fn unsupported_algorithm() -> NetworkError
pub fn unsupported_algorithm() -> NetworkError
The requested algorithm is not supported.
pub fn account_client_exists(cid: u64) -> NetworkError
pub fn account_client_exists(cid: u64) -> NetworkError
A client account already exists (cid).
pub fn account_client_non_exists(cid: u64) -> NetworkError
pub fn account_client_non_exists(cid: u64) -> NetworkError
The referenced client account does not exist (cid).
pub fn account_server_exists(cid: u64) -> NetworkError
pub fn account_server_exists(cid: u64) -> NetworkError
A server account already exists (cid).
pub fn account_server_non_exists(cid: u64) -> NetworkError
pub fn account_server_non_exists(cid: u64) -> NetworkError
The referenced server account does not exist (cid).
pub fn account_invalid_username() -> NetworkError
pub fn account_invalid_username() -> NetworkError
The supplied username was invalid.
pub fn account_invalid_password() -> NetworkError
pub fn account_invalid_password() -> NetworkError
The supplied password was invalid.
pub fn account_disengaged(cid: u64) -> NetworkError
pub fn account_disengaged(cid: u64) -> NetworkError
The account is disengaged / deregistered (cid).
pub fn firewall_upnp(msg: impl ErrorArgs) -> NetworkError
pub fn firewall_upnp(msg: impl ErrorArgs) -> NetworkError
A UPnP operation failed.
pub fn firewall_hole_punch(msg: impl ErrorArgs) -> NetworkError
pub fn firewall_hole_punch(msg: impl ErrorArgs) -> NetworkError
A hole-punch operation failed.
pub fn firewall_skip() -> NetworkError
pub fn firewall_skip() -> NetworkError
Firewall traversal was deliberately skipped.
pub fn firewall_not_applicable() -> NetworkError
pub fn firewall_not_applicable() -> NetworkError
Firewall traversal was not applicable in this context.
pub fn firewall_hole_punch_exhausted() -> NetworkError
pub fn firewall_hole_punch_exhausted() -> NetworkError
All hole-punch attempts were exhausted.
pub fn firewall_local_ip_fail() -> NetworkError
pub fn firewall_local_ip_fail() -> NetworkError
The local IP address could not be determined.
pub fn channel_send(msg: impl ErrorArgs) -> NetworkError
pub fn channel_send(msg: impl ErrorArgs) -> NetworkError
A channel send failed (receiver gone or full).
pub fn channel_recv() -> NetworkError
pub fn channel_recv() -> NetworkError
A channel receive failed (sender gone).
pub fn channel_internal(msg: impl ErrorArgs) -> NetworkError
pub fn channel_internal(msg: impl ErrorArgs) -> NetworkError
An internal channel invariant was violated.
pub fn ip_retrieve(msg: impl ErrorArgs) -> NetworkError
pub fn ip_retrieve(msg: impl ErrorArgs) -> NetworkError
Failed to retrieve the public/external IP address.
pub fn rtdb(msg: impl ErrorArgs) -> NetworkError
pub fn rtdb(msg: impl ErrorArgs) -> NetworkError
A Firebase RTDB operation failed.
§impl NetworkError
impl NetworkError
pub fn from_parts(
code: ErrorCode,
origin: &'static str,
args: Vec<Box<dyn ErrorArgs>>,
) -> NetworkError
pub fn from_parts( code: ErrorCode, origin: &'static str, args: Vec<Box<dyn ErrorArgs>>, ) -> NetworkError
Build an error from its parts. Prefer the [crate::error!] macro, which captures origin
and validates the argument count at compile time. args[i] fills the i-th {} in the form.
pub fn code(&self) -> ErrorCode
pub fn code(&self) -> ErrorCode
The stable error code.
pub fn code_u16(&self) -> u16
pub fn code_u16(&self) -> u16
The stable numeric error code (the [ErrorCode] #[repr(u16)] discriminant).
pub fn error_source(&self) -> &'static str
pub fn error_source(&self) -> &'static str
The call-site "file:line" where this error was raised.
pub fn into_string(self) -> String
pub fn into_string(self) -> String
Consume into the full rendered message.
Trait Implementations§
§impl Clone for NetworkError
impl Clone for NetworkError
§fn clone(&self) -> NetworkError
fn clone(&self) -> NetworkError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for NetworkError
impl Debug for NetworkError
§impl Deref for NetworkError
impl Deref for NetworkError
§impl DerefMut for NetworkError
impl DerefMut for NetworkError
§impl Display for NetworkError
impl Display for NetworkError
§impl Error for NetworkError
impl Error for NetworkError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
§impl From<Error> for NetworkError
impl From<Error> for NetworkError
§fn from(err: Error) -> NetworkError
fn from(err: Error) -> NetworkError
§impl<T> From<SendError<T>> for NetworkError
impl<T> From<SendError<T>> for NetworkError
§fn from(err: SendError<T>) -> NetworkError
fn from(err: SendError<T>) -> NetworkError
§impl Hash for NetworkError
impl Hash for NetworkError
§impl PartialEq for NetworkError
Errors compare equal iff they carry the same [ErrorCode] (arguments and origin are ignored).
impl PartialEq for NetworkError
Errors compare equal iff they carry the same [ErrorCode] (arguments and origin are ignored).
impl Eq for NetworkError
Auto Trait Implementations§
impl Freeze for NetworkError
impl !RefUnwindSafe for NetworkError
impl Send for NetworkError
impl Sync for NetworkError
impl Unpin for NetworkError
impl UnsafeUnpin for NetworkError
impl !UnwindSafe for NetworkError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T, J> IfEqConditional<J> for Twhere
T: PartialEq,
impl<T, J> IfEqConditional<J> for Twhere
T: PartialEq,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.