pgdo/cluster/
error.rs

1use std::{io, process::Output};
2
3use crate::{cluster, runtime, util, version};
4
5#[derive(thiserror::Error, miette::Diagnostic, Debug)]
6pub enum ClusterError {
7    #[error("Input/output error")]
8    IoError(#[from] io::Error),
9    #[error("PostgreSQL version not supported: {0}")]
10    UnsupportedVersion(version::Version),
11    #[error("PostgreSQL version not known")]
12    VersionError(#[from] version::VersionError),
13    #[error("PostgreSQL runtime not found for version {0}")]
14    RuntimeNotFound(version::PartialVersion),
15    #[error("PostgreSQL runtime not found")]
16    RuntimeDefaultNotFound,
17    #[error("Runtime error")]
18    RuntimeError(#[from] runtime::RuntimeError),
19    #[error("Database error")]
20    DatabaseError(#[from] cluster::postgres::Error),
21    #[error("Database error")]
22    SqlxError(#[from] cluster::sqlx::Error),
23    #[error("Cluster in use; cannot lock exclusively")]
24    InUse,
25    #[error("External command failed: {0:?}")]
26    CommandError(Output),
27    #[error(transparent)]
28    CurrentUserError(#[from] util::CurrentUserError),
29    #[error("URL error")]
30    UrlError(#[from] url::ParseError),
31}