use thiserror::Error;
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum StoreError {
#[error("I/O error on state file: {0}")]
Io(#[from] std::io::Error),
#[error("could not serialise state to JSON: {0}")]
Encode(#[source] serde_json::Error),
#[error("could not parse state file: {0}")]
Decode(#[source] serde_json::Error),
#[error("state file format version {found} does not match supported version {supported}")]
UnsupportedFileVersion {
found: u32,
supported: u32,
},
#[error("state file uses key_format_version {found}; this client uses {supported}")]
UnsupportedKeyFormatVersion {
found: u32,
supported: u32,
},
#[error("invalid resume key in state file: {message}")]
InvalidResumeKey {
message: String,
},
#[error("background task that performed the disk operation failed: {0}")]
BackgroundTaskFailed(#[source] tokio::task::JoinError),
}