#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum StoreError {
#[error("commit refused: {0}")]
Commit(#[from] openehr::rm::common::CommitError),
#[error("no such {kind}: {id}")]
NotFound {
kind: &'static str,
id: String,
},
#[error("{kind} already exists: {id}")]
Conflict {
kind: &'static str,
id: String,
},
#[error("{0}")]
Invalid(#[from] openehr::ValidationReport),
#[error(transparent)]
Parse(#[from] openehr::ParseError),
#[error("canonical JSON: {0}")]
Json(#[from] serde_json::Error),
#[error("{engine}: {message}")]
Engine {
engine: &'static str,
message: String,
},
#[error("unsupported by {engine}: {what} (see {spec_ref})")]
Unsupported {
engine: &'static str,
what: &'static str,
spec_ref: &'static str,
},
}
pub type Result<T, E = StoreError> = core::result::Result<T, E>;