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> { |