#[non_exhaustive]pub enum SyncError {
Show 41 variants
NoTransportEnabled,
SyncNotEnabled,
ServerAlreadyRunning {
address: String,
},
ServerNotRunning,
UnexpectedResponse {
expected: &'static str,
actual: String,
},
Network(String),
CommandSendError(String),
TransportInit(String),
RuntimeCreation(String),
ServerBind {
address: String,
reason: String,
},
ConnectionFailed {
address: String,
reason: String,
},
Timeout {
address: String,
phase: TimeoutPhase,
elapsed: Duration,
},
DeviceKeyNotFound {
key_name: String,
},
UnsupportedTransport {
transport_type: String,
},
InvalidAddress(String),
PeerNotFound(String),
PeerAlreadyExists(String),
SerializationError(String),
ProtocolMismatch {
expected: u32,
received: u32,
},
HandshakeFailed(String),
EntryNotFound(ID),
InvalidEntry(String),
SyncProtocolError(String),
BackendError(String),
RequestNotFound(String),
RequestAlreadyExists(String),
InvalidRequestState {
request_id: String,
current_status: String,
expected_status: String,
},
InvalidData(String),
InsufficientPermission {
request_id: String,
required_permission: String,
actual_permission: Permission,
},
AuthenticationRequired(String),
AuthenticationFailed(String),
PermissionDenied(String),
InvalidPublicKey {
reason: String,
},
InvalidKeyName {
reason: String,
},
InstanceDropped,
BootstrapPending {
request_id: String,
message: String,
},
BootstrapRejected {
request_id: String,
message: String,
},
TransportTypeMismatch {
name: String,
expected: String,
found: String,
},
TransportNotFound {
name: String,
},
NoTransportForAddress {
address: Address,
},
MultipleTransportErrors {
errors: Vec<String>,
},
}Expand description
Errors that can occur during synchronization operations.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoTransportEnabled
No transport has been enabled for network operations.
SyncNotEnabled
Sync has not been enabled on the Instance.
ServerAlreadyRunning
Attempted to start a server when one is already running.
ServerNotRunning
Attempted to stop a server when none is running.
UnexpectedResponse
Unexpected response type received from peer.
Network(String)
Network communication error.
CommandSendError(String)
Command channel send error.
TransportInit(String)
Transport initialization error.
RuntimeCreation(String)
Runtime creation error for async operations.
ServerBind
Server bind error.
ConnectionFailed
Client connection error.
Timeout
A peer did not answer within the transport’s deadline.
Kept apart from SyncError::ConnectionFailed and
SyncError::Network because a caller reacts differently to silence
than to a refusal: a peer that never answered is worth asking again,
while one that answered with an error usually is not. phase carries
what the peer proved about itself before the deadline.
DeviceKeyNotFound
Device key not found in backend storage.
UnsupportedTransport
Transport type not supported by this transport implementation.
InvalidAddress(String)
Invalid address format.
PeerNotFound(String)
Peer not found.
PeerAlreadyExists(String)
Peer already exists.
SerializationError(String)
Serialization error.
ProtocolMismatch
Protocol version mismatch.
HandshakeFailed(String)
Handshake failed.
EntryNotFound(ID)
Entry not found in backend storage.
InvalidEntry(String)
Invalid entry received (validation failed).
SyncProtocolError(String)
Sync protocol error.
BackendError(String)
Backend storage error.
RequestNotFound(String)
Bootstrap request not found.
RequestAlreadyExists(String)
Bootstrap request already exists.
InvalidRequestState
Invalid bootstrap request state.
InvalidData(String)
Invalid data format in stored bootstrap request.
InsufficientPermission
Insufficient permission for the requested operation.
AuthenticationRequired(String)
A request that would be served data carried no proof of key possession.
AuthenticationFailed(String)
The proof of key possession did not hold up.
PermissionDenied(String)
The caller proved its key, but that key has no read access.
InvalidPublicKey
Invalid public key provided.
InvalidKeyName
Invalid key name provided.
InstanceDropped
Instance has been dropped and is no longer available.
BootstrapPending
Bootstrap request is pending manual approval.
BootstrapRejected
Bootstrap request was rejected by an administrator.
TransportTypeMismatch
Transport configuration type mismatch.
TransportNotFound
Transport not found by name.
NoTransportForAddress
No transport can handle the given address.
MultipleTransportErrors
Multiple transport operations failed.
Implementations§
Source§impl SyncError
impl SyncError
Sourcepub fn is_configuration_error(&self) -> bool
pub fn is_configuration_error(&self) -> bool
Check if this is a configuration error: the sync stack isn’t ready (sync not attached or no transport registered).
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Check if this is a server lifecycle error.
Sourcepub fn is_network_error(&self) -> bool
pub fn is_network_error(&self) -> bool
Check if this is a network/connection error.
Includes timeouts: a deadline that expires is one way a network call fails, and callers classifying by this predicate should not have to learn about a new variant to keep treating it as one.
Sourcepub fn timeout_phase(&self) -> Option<TimeoutPhase>
pub fn timeout_phase(&self) -> Option<TimeoutPhase>
Check if this is a timeout, and if so in which phase.
Some(TimeoutPhase::Request) means the peer was reachable and stopped
answering; Some(TimeoutPhase::Connect) means it never answered at all.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Check if this is a timeout rather than a refusal or a protocol failure.
Sourcepub fn is_protocol_error(&self) -> bool
pub fn is_protocol_error(&self) -> bool
Check if this is a protocol error (unexpected response).
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Check if this is a not found error.
Sourcepub fn is_validation_error(&self) -> bool
pub fn is_validation_error(&self) -> bool
Check if this is a validation error.
Sourcepub fn is_backend_error(&self) -> bool
pub fn is_backend_error(&self) -> bool
Check if this is a backend error.
Trait Implementations§
Source§impl Error for SyncError
impl Error for SyncError
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()
Auto Trait Implementations§
impl Freeze for SyncError
impl RefUnwindSafe for SyncError
impl Send for SyncError
impl Sync for SyncError
impl Unpin for SyncError
impl UnsafeUnpin for SyncError
impl UnwindSafe for SyncError
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<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