pub enum VeilidAPIError {
Show 15 variants
NotInitialized,
AlreadyInitialized,
Timeout,
TryAgain {
message: String,
},
InvalidTarget {
message: String,
},
NoConnection {
message: String,
},
Shutdown,
KeyNotFound {
key: OpaqueRecordKey,
},
Internal {
message: String,
},
Unimplemented {
message: String,
},
ParseError {
message: String,
value: String,
},
InvalidArgument {
context: String,
argument: String,
value: String,
},
MissingArgument {
context: String,
argument: String,
},
Generic {
message: String,
},
TransactionNotFound {
message: String,
},
}Expand description
Error type returned by all fallible Veilid API operations.
Variants§
NotInitialized
The API was used before VeilidAPI was attached, or after it was detached.
AlreadyInitialized
An attempt was made to initialize Veilid while it was already running.
Timeout
The operation did not complete within its time budget.
TryAgain
The operation could not be completed yet and should be retried later.
InvalidTarget
The destination for an operation could not be reached or is malformed.
NoConnection
No network connection could be established to carry out the operation.
Shutdown
The API is shutting down and can no longer service requests.
KeyNotFound
The requested DHT record key is not present in local storage.
Fields
key: OpaqueRecordKeyThe record key that was not found.
Internal
An internal invariant was violated; indicates a bug in Veilid itself.
Unimplemented
The requested feature exists in the API surface but is not yet implemented on this platform or build.
ParseError
A value could not be parsed into its expected form.
Fields
InvalidArgument
An argument was supplied but its value was rejected.
Fields
MissingArgument
A required argument was not supplied.
Fields
Generic
A failure that does not fit any more specific category.
TransactionNotFound
The referenced DHT transaction does not exist, having expired or never been opened.
Implementations§
Source§impl VeilidAPIError
impl VeilidAPIError
Sourcepub fn not_initialized() -> Self
pub fn not_initialized() -> Self
Construct a VeilidAPIError::NotInitialized error.
Sourcepub fn already_initialized() -> Self
pub fn already_initialized() -> Self
Construct a VeilidAPIError::AlreadyInitialized error.
Sourcepub fn timeout() -> Self
pub fn timeout() -> Self
Construct a VeilidAPIError::Timeout error.
Sourcepub fn try_again<T: ToVeilidAPIErrorArgument>(msg: T) -> Self
pub fn try_again<T: ToVeilidAPIErrorArgument>(msg: T) -> Self
Construct a VeilidAPIError::TryAgain error with the given message.
Sourcepub fn shutdown() -> Self
pub fn shutdown() -> Self
Construct a VeilidAPIError::Shutdown error.
Sourcepub fn invalid_target<T: ToVeilidAPIErrorArgument>(msg: T) -> Self
pub fn invalid_target<T: ToVeilidAPIErrorArgument>(msg: T) -> Self
Construct a VeilidAPIError::InvalidTarget error with the given message.
Sourcepub fn no_connection<T: ToVeilidAPIErrorArgument>(msg: T) -> Self
pub fn no_connection<T: ToVeilidAPIErrorArgument>(msg: T) -> Self
Construct a VeilidAPIError::NoConnection error with the given message.
Sourcepub fn key_not_found(key: OpaqueRecordKey) -> Self
pub fn key_not_found(key: OpaqueRecordKey) -> Self
Construct a VeilidAPIError::KeyNotFound error for the given record key.
Sourcepub fn parse_error<T: ToVeilidAPIErrorArgument, S: ToVeilidAPIErrorArgument>(
msg: T,
value: S,
) -> Self
pub fn parse_error<T: ToVeilidAPIErrorArgument, S: ToVeilidAPIErrorArgument>( msg: T, value: S, ) -> Self
Construct a VeilidAPIError::ParseError error with the given message and offending value.
Sourcepub fn invalid_argument<T: ToVeilidAPIErrorArgument, S: ToVeilidAPIErrorArgument, R: ToVeilidAPIErrorArgument>(
context: T,
argument: S,
value: R,
) -> Self
pub fn invalid_argument<T: ToVeilidAPIErrorArgument, S: ToVeilidAPIErrorArgument, R: ToVeilidAPIErrorArgument>( context: T, argument: S, value: R, ) -> Self
Construct a VeilidAPIError::InvalidArgument error naming the context, argument, and rejected value.
Sourcepub fn missing_argument<T: ToVeilidAPIErrorArgument, S: ToVeilidAPIErrorArgument>(
context: T,
argument: S,
) -> Self
pub fn missing_argument<T: ToVeilidAPIErrorArgument, S: ToVeilidAPIErrorArgument>( context: T, argument: S, ) -> Self
Construct a VeilidAPIError::MissingArgument error naming the context and the missing argument.
Sourcepub fn generic<T: ToVeilidAPIErrorArgument>(msg: T) -> Self
pub fn generic<T: ToVeilidAPIErrorArgument>(msg: T) -> Self
Construct a VeilidAPIError::Generic error with the given message.
Sourcepub fn from_network_result<T>(nr: NetworkResult<T>) -> Result<T, Self>
pub fn from_network_result<T>(nr: NetworkResult<T>) -> Result<T, Self>
Convert a NetworkResult into a VeilidAPIResult, mapping each non-value outcome to the matching error variant.
Sourcepub fn internal<T: ToString>(msg: T) -> Self
pub fn internal<T: ToString>(msg: T) -> Self
Construct a VeilidAPIError::Internal error with the given message. Constructing one signals a bug in Veilid.
Sourcepub fn unimplemented<T: ToString>(msg: T) -> Self
pub fn unimplemented<T: ToString>(msg: T) -> Self
Construct a VeilidAPIError::Unimplemented error with the given message.
Trait Implementations§
Source§impl Clone for VeilidAPIError
impl Clone for VeilidAPIError
Source§fn clone(&self) -> VeilidAPIError
fn clone(&self) -> VeilidAPIError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VeilidAPIError
impl Debug for VeilidAPIError
Source§impl<'de> Deserialize<'de> for VeilidAPIError
impl<'de> Deserialize<'de> for VeilidAPIError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for VeilidAPIError
impl Display for VeilidAPIError
impl Eq for VeilidAPIError
Source§impl Error for VeilidAPIError
impl Error for VeilidAPIError
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()
Source§impl From<Error> for VeilidAPIError
impl From<Error> for VeilidAPIError
Source§impl Ord for VeilidAPIError
impl Ord for VeilidAPIError
Source§fn cmp(&self, other: &VeilidAPIError) -> Ordering
fn cmp(&self, other: &VeilidAPIError) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for VeilidAPIError
impl PartialEq for VeilidAPIError
Source§impl PartialOrd for VeilidAPIError
impl PartialOrd for VeilidAPIError
Source§impl Serialize for VeilidAPIError
impl Serialize for VeilidAPIError
impl StructuralPartialEq for VeilidAPIError
Auto Trait Implementations§
impl !Freeze for VeilidAPIError
impl RefUnwindSafe for VeilidAPIError
impl Send for VeilidAPIError
impl Sync for VeilidAPIError
impl Unpin for VeilidAPIError
impl UnsafeUnpin for VeilidAPIError
impl UnwindSafe for VeilidAPIError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CmpAssign for Twhere
T: Ord,
impl<T> CmpAssign for Twhere
T: Ord,
Source§fn min_assign(&mut self, other: T)
fn min_assign(&mut self, other: T)
self with other if other is smaller.Source§fn max_assign(&mut self, other: T)
fn max_assign(&mut self, other: T)
self with other if other is larger.Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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