1#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
3#[non_exhaustive]
4pub enum Error {
5 #[error("object store: {0}")]
7 Store(String),
8
9 #[error("not found: {0}")]
11 NotFound(String),
12
13 #[error("unknown version {0}")]
15 Version(u64),
16
17 #[error("{0} exceeds the recording id range")]
19 Id(u64),
20
21 #[error("timescale {0} is outside 1..=9007199254740991")]
23 Timescale(u64),
24
25 #[error("priority {existing} does not match {intended}")]
27 Priority { existing: u8, intended: u8 },
28
29 #[error("timescale {existing} does not match {intended}")]
31 TimescaleMismatch { existing: u64, intended: u64 },
32
33 #[error("empty object")]
35 Empty,
36
37 #[error("group sequences are not strictly ascending")]
39 Sequence,
40
41 #[error("invalid or mismatched group bounds {smallest}..={largest}")]
43 Bounds { smallest: u64, largest: u64 },
44
45 #[error("malformed table")]
47 Table,
48
49 #[error("overflow")]
51 Overflow,
52
53 #[error("invalid track name")]
55 Track,
56
57 #[error("invalid path: {0}")]
59 Path(String),
60
61 #[error("directory listing is unsupported: {0}")]
63 Directory(String),
64
65 #[error("continuation query requires list_paginated")]
67 Pagination,
68
69 #[error("conflicting object: {0}")]
71 Conflict(String),
72
73 #[error("json: {0}")]
75 Json(String),
76}
77
78impl From<object_store::Error> for Error {
79 fn from(err: object_store::Error) -> Self {
80 match err {
81 object_store::Error::NotFound { path, .. } => Self::NotFound(path),
82 other => Self::Store(other.to_string()),
83 }
84 }
85}
86
87impl From<serde_json::Error> for Error {
88 fn from(err: serde_json::Error) -> Self {
89 Self::Json(err.to_string())
90 }
91}
92
93pub type Result<T> = std::result::Result<T, Error>;