mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
add subcmd to repair some persistent state
This commit is contained in:
parent
5be1e20eb4
commit
07d05fa1f9
3 changed files with 131 additions and 0 deletions
25
src/error.rs
25
src/error.rs
|
|
@ -48,6 +48,9 @@ pub(crate) enum Main {
|
|||
|
||||
#[error(transparent)]
|
||||
CheckConfigCommand(#[from] CheckConfigCommand),
|
||||
|
||||
#[error(transparent)]
|
||||
RepairCommand(#[from] RepairCommand),
|
||||
}
|
||||
|
||||
/// Errors returned from the `serve` CLI subcommand.
|
||||
|
|
@ -85,6 +88,28 @@ pub(crate) enum CheckConfigCommand {
|
|||
Config(#[from] Config),
|
||||
}
|
||||
|
||||
/// Errors returned from the `repair` CLI subcommand.
|
||||
// Missing docs are allowed here since that kind of information should be
|
||||
// encoded in the error messages themselves anyway.
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Error, Debug)]
|
||||
pub(crate) enum RepairCommand {
|
||||
#[error("failed to load configuration")]
|
||||
Config(#[from] Config),
|
||||
|
||||
#[error("failed to load or create the database")]
|
||||
Database(#[source] crate::utils::error::Error),
|
||||
|
||||
#[error("failed to initialize services")]
|
||||
InitializeServices(#[source] crate::utils::error::Error),
|
||||
|
||||
#[error("`server_name` change check failed")]
|
||||
ServerNameChanged(#[from] ServerNameChanged),
|
||||
|
||||
#[error("repair \"{0}\" failed, restoring from a backup is recommended")]
|
||||
Repair(&'static str, #[source] Box<dyn std::error::Error>),
|
||||
}
|
||||
|
||||
/// Error generated if `server_name` has changed or if checking this failed
|
||||
// Missing docs are allowed here since that kind of information should be
|
||||
// encoded in the error messages themselves anyway.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue