update error enum names
This commit is contained in:
parent
a09555b7d9
commit
e807488471
5 changed files with 10 additions and 3 deletions
|
@ -16,8 +16,9 @@ pub(crate) enum Commands {
|
|||
Validate,
|
||||
}
|
||||
|
||||
/// Errors that can happen in `config` subcommand
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub(crate) enum Error {
|
||||
pub(crate) enum ConfigError {
|
||||
#[error(transparent)]
|
||||
Update(#[from] update::UpdateError),
|
||||
#[error(transparent)]
|
||||
|
@ -89,7 +90,7 @@ fn next_revision() -> Result<Option<Revision>, RevisionCheckError> {
|
|||
Ok(next_revision)
|
||||
}
|
||||
|
||||
pub(crate) async fn run(command: Commands) -> Result<(), Error> {
|
||||
pub(crate) async fn run(command: Commands) -> Result<(), ConfigError> {
|
||||
match command {
|
||||
Commands::Update { revision } => update::run(revision).await?,
|
||||
Commands::Validate => validate::run()?,
|
||||
|
|
|
@ -10,6 +10,7 @@ use chrono::Local;
|
|||
use color_print::cprintln;
|
||||
use std::{fs, io};
|
||||
|
||||
/// Errors that happen in `config update` subcommand
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub(crate) enum UpdateError {
|
||||
#[error(transparent)]
|
||||
|
|
|
@ -15,6 +15,7 @@ use std::{
|
|||
use url::Url;
|
||||
use yaml_rust::{Yaml, YamlLoader};
|
||||
|
||||
/// Errors that can happen in `config update v1` subcommand
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub(crate) enum Error {
|
||||
#[error("failed to parse the old config file ({})", OLD_CONFIG_PATH)]
|
||||
|
@ -29,6 +30,7 @@ pub(crate) enum Error {
|
|||
InvalidUrl(#[from] url::ParseError),
|
||||
}
|
||||
|
||||
/// Errors that can happen while reading `.config/default.yml`
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub(crate) enum ReadYamlConfigError {
|
||||
#[error(transparent)]
|
||||
|
@ -39,6 +41,7 @@ pub(crate) enum ReadYamlConfigError {
|
|||
InvalidConfig(String),
|
||||
}
|
||||
|
||||
/// Errors that can happen while writing `config/{server,client}.toml`
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub(crate) enum WriteTomlConfigError {
|
||||
#[error("failed to serialize the new server config into TOML format")]
|
||||
|
|
|
@ -8,6 +8,7 @@ use color_print::cprintln;
|
|||
use std::{fs, io::Read};
|
||||
use validator::Validate;
|
||||
|
||||
/// Errors that can happen in `config validate` subcommand
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub(crate) enum ValidationError {
|
||||
#[error(transparent)]
|
||||
|
|
|
@ -5,10 +5,11 @@ mod version;
|
|||
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
/// Errors that can happen in any commands
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub(crate) enum Error {
|
||||
#[error(transparent)]
|
||||
Config(#[from] config::Error),
|
||||
Config(#[from] config::ConfigError),
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
|
|
Loading…
Reference in a new issue