rust/hg-core/src/errors.rs
changeset 46731 3d692e724d06
parent 46599 1f55cd5b292f
child 46735 12d59eec7f1d
equal deleted inserted replaced
46730:dfd35823635b 46731:3d692e724d06
    76 impl fmt::Display for HgError {
    76 impl fmt::Display for HgError {
    77     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    77     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    78         match self {
    78         match self {
    79             HgError::Abort(explanation) => write!(f, "{}", explanation),
    79             HgError::Abort(explanation) => write!(f, "{}", explanation),
    80             HgError::IoError { error, context } => {
    80             HgError::IoError { error, context } => {
    81                 write!(f, "{}: {}", error, context)
    81                 write!(f, "abort: {}: {}", context, error)
    82             }
    82             }
    83             HgError::CorruptedRepository(explanation) => {
    83             HgError::CorruptedRepository(explanation) => {
    84                 write!(f, "corrupted repository: {}", explanation)
    84                 write!(f, "abort: corrupted repository: {}", explanation)
    85             }
    85             }
    86             HgError::UnsupportedFeature(explanation) => {
    86             HgError::UnsupportedFeature(explanation) => {
    87                 write!(f, "unsupported feature: {}", explanation)
    87                 write!(f, "unsupported feature: {}", explanation)
    88             }
    88             }
    89             HgError::ConfigValueParseError(ConfigValueParseError {
    89             HgError::ConfigValueParseError(ConfigValueParseError {
   126                 f,
   126                 f,
   127                 "when renaming {} to {}",
   127                 "when renaming {} to {}",
   128                 from.display(),
   128                 from.display(),
   129                 to.display()
   129                 to.display()
   130             ),
   130             ),
   131             IoErrorContext::CurrentDir => write!(f, "current directory"),
   131             IoErrorContext::CurrentDir => {
   132             IoErrorContext::CurrentExe => write!(f, "current executable"),
   132                 write!(f, "error getting current working directory")
       
   133             }
       
   134             IoErrorContext::CurrentExe => {
       
   135                 write!(f, "error getting current executable")
       
   136             }
   133         }
   137         }
   134     }
   138     }
   135 }
   139 }
   136 
   140 
   137 pub trait IoResultExt<T> {
   141 pub trait IoResultExt<T> {