Skip to main content

readcon_db/
error.rs

1use crate::keys::FrameKey;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum Error {
6    #[error("heed: {0}")]
7    Heed(#[from] heed::Error),
8    #[error("io: {0}")]
9    Io(#[from] std::io::Error),
10    #[error("parse frame: {0}")]
11    Parse(String),
12    #[error("missing frame {0:?}")]
13    MissingFrame(FrameKey),
14    #[error("trajectory {0} already exists (n_frames={1}); use a new traj_id")]
15    TrajExists(u64, u32),
16    #[error("utf-8: {0}")]
17    Utf8(#[from] std::str::Utf8Error),
18    #[error("json: {0}")]
19    Json(#[from] serde_json::Error),
20    #[error("nul in path or string")]
21    Nul,
22    #[error("{0}")]
23    Message(String),
24}
25
26pub type Result<T> = std::result::Result<T, Error>;