1use crate::db;
2use snafu::Snafu;
3
4#[derive(Debug, Snafu)]
5#[snafu(visibility = "pub(crate)")]
6pub enum Error {
7 #[snafu(display("`include_keys` and `include_values` were both false. Pick one or both."))]
8 IncludeKeysIncludeValuesBothFalse {},
9 #[snafu(display("Could not encode legacy value as vec"))]
10 EncodingValueAsVecError {},
11 #[snafu(display("Error, tried to parse contents of db as legacy Value. This should never fail. The db may be corrupt. Rebuild the indexes"))]
12 ErrorParsingAsLegacyValue {},
13 #[snafu(display("Error, could not find message in db. {}", source))]
14 MessageNotFound { source: db::Error },
15 #[snafu(display("Error, could not find feed in db. {}", source))]
16 FeedNotFound { source: db::Error },
17 #[snafu(display("Error, could not batch append to offset file."))]
18 OffsetAppendError {},
19 #[snafu(display("Error, could not batch append to sqlite db."))]
20 SqliteAppendError {},
21 #[snafu(display("Error, could not find entry at expected offset."))]
22 OffsetGetError {},
23 #[snafu(display(
24 "Error, could not get the latest sequence number from the db. {}",
25 source
26 ))]
27 UnableToGetLatestSequence { source: db::Error },
28}
29
30pub type Result<T, E = Error> = std::result::Result<T, E>;