mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-15 08:53:16 +00:00
cli: wrap clap::Error within Arc to make CommandError cloneable
This allows us to load workspace by using &Result<T, CommandError>. Even though load_workspace() wouldn't be called more than once, consuming self there is annoying.
This commit is contained in:
parent
1df1603b0b
commit
c3903cb914
1 changed files with 3 additions and 3 deletions
|
@ -58,7 +58,7 @@ use crate::merge_tools::{ConflictResolveError, DiffEditError};
|
|||
use crate::templater::TemplateFormatter;
|
||||
use crate::ui::{ColorChoice, Ui};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum CommandError {
|
||||
UserError {
|
||||
message: String,
|
||||
|
@ -68,7 +68,7 @@ pub enum CommandError {
|
|||
/// Invalid command line
|
||||
CliError(String),
|
||||
/// Invalid command line detected by clap
|
||||
ClapCliError(clap::Error),
|
||||
ClapCliError(Arc<clap::Error>),
|
||||
BrokenPipe,
|
||||
InternalError(String),
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ impl From<glob::PatternError> for CommandError {
|
|||
|
||||
impl From<clap::Error> for CommandError {
|
||||
fn from(err: clap::Error) -> Self {
|
||||
CommandError::ClapCliError(err)
|
||||
CommandError::ClapCliError(Arc::new(err))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue