rust/rhg/src/error.rs
changeset 45383 5dbf875b3275
parent 45381 47997afadf08
child 45384 5fe25f8ef5d9
equal deleted inserted replaced
45382:eb55274d3650 45383:5dbf875b3275
     1 use crate::exitcode;
     1 use crate::exitcode;
     2 use crate::ui::UiError;
     2 use crate::ui::UiError;
       
     3 use hg::operations::{FindRootError, FindRootErrorKind};
     3 use hg::utils::files::get_bytes_from_path;
     4 use hg::utils::files::get_bytes_from_path;
     4 use std::convert::From;
     5 use std::convert::From;
     5 use std::path::PathBuf;
     6 use std::path::PathBuf;
     6 
     7 
     7 /// The kind of command error
     8 /// The kind of command error
    88                 UiError::StderrError(_) => CommandErrorKind::StderrError,
    89                 UiError::StderrError(_) => CommandErrorKind::StderrError,
    89             },
    90             },
    90         }
    91         }
    91     }
    92     }
    92 }
    93 }
       
    94 
       
    95 impl From<FindRootError> for CommandError {
       
    96     fn from(err: FindRootError) -> Self {
       
    97         match err.kind {
       
    98             FindRootErrorKind::RootNotFound(path) => CommandError {
       
    99                 kind: CommandErrorKind::RootNotFound(path),
       
   100             },
       
   101             FindRootErrorKind::GetCurrentDirError(e) => CommandError {
       
   102                 kind: CommandErrorKind::CurrentDirNotFound(e),
       
   103             },
       
   104         }
       
   105     }
       
   106 }