#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum Error {
#[error("object store: {0}")]
Store(String),
#[error("not found: {0}")]
NotFound(String),
#[error("unknown version {0}")]
Version(u64),
#[error("{0} exceeds the recording id range")]
Id(u64),
#[error("timescale {0} is outside 1..=9007199254740991")]
Timescale(u64),
#[error("priority {existing} does not match {intended}")]
Priority { existing: u8, intended: u8 },
#[error("timescale {existing} does not match {intended}")]
TimescaleMismatch { existing: u64, intended: u64 },
#[error("empty object")]
Empty,
#[error("group sequences are not strictly ascending")]
Sequence,
#[error("invalid or mismatched group bounds {smallest}..={largest}")]
Bounds { smallest: u64, largest: u64 },
#[error("malformed table")]
Table,
#[error("overflow")]
Overflow,
#[error("invalid track name")]
Track,
#[error("invalid path: {0}")]
Path(String),
#[error("directory listing is unsupported: {0}")]
Directory(String),
#[error("continuation query requires list_paginated")]
Pagination,
#[error("conflicting object: {0}")]
Conflict(String),
#[error("json: {0}")]
Json(String),
}
impl From<object_store::Error> for Error {
fn from(err: object_store::Error) -> Self {
match err {
object_store::Error::NotFound { path, .. } => Self::NotFound(path),
other => Self::Store(other.to_string()),
}
}
}
impl From<serde_json::Error> for Error {
fn from(err: serde_json::Error) -> Self {
Self::Json(err.to_string())
}
}
pub type Result<T> = std::result::Result<T, Error>;