Skip to main content

objectiveai_cli/db/
error.rs

1//! Error type for the postgres-backed CLI state.
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5    #[error("sqlx: {0}")]
6    Sqlx(#[from] sqlx::Error),
7    #[error("inline JSON: {0}")]
8    Json(#[from] serde_json::Error),
9    #[error("invalid data: {0}")]
10    InvalidData(String),
11    #[error("cannot reach the database at {url} ({source}); run `objectiveai db spawn` to start the local objectiveai-db, or point `db config address` at a reachable postgres")]
12    DbUnreachable {
13        /// Connect URL with the password masked.
14        url: String,
15        source: Box<sqlx::Error>,
16    },
17}