pub enum SyncError {
UnexpectedBehaviour(String),
InvalidEncoding(String),
Critical(String),
}Expand description
Errors which can occur during sync sessions.
- Critical system failures (ie. bug in p2panda code or sync implementation, sync implementation did not follow “2. Phase Flow” requirements, lack of system resources, etc.)
- Unexpected Behaviour (ie. remote peer abruptly disconnected, error which got correctly caught in sync implementation, etc.)
Variants§
UnexpectedBehaviour(String)
Error due to unexpected (buggy or malicious) behaviour of the remote peer.
Indicates that the sync protocol was not correctly followed, for example due to unexpected or missing messages, etc.
Can be used by a backend to re-attempt syncing with this peer or down-grading it in priority, potentially deny-listing if communication failed too often.
InvalidEncoding(String)
Error due to invalid encoding of a message sent by remote peer.
Note that this error is intended for receiving messages from remote peers which we can’t
decode properly. If we fail with encoding our own messages we should rather consider this
an Critical error type, as it likely means that there’s a buggy implementation.
Critical(String)
Critical error due to system failure on our end.
This indicates that our system is running out of resources (storage layer failure etc.) or we have a buggy implementation.
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
Source§impl From<Error> for SyncError
impl From<Error> for SyncError
Converts critical I/O error (which occurs during codec stream handling) into SyncError.
This is usually a critical system failure indicating an implementation bug or lacking resources on the user’s machine.
See Encoder or Decoder Error trait type in tokio’s codec for more information:
https://docs.rs/tokio-util/latest/tokio_util/codec/trait.Decoder.html#associatedtype.Error