Mercurial > hg-stable
comparison rust/hg-core/src/errors.rs @ 46744:3d692e724d06
rhg: Align config file parse error formatting with Python
Differences can cause tests to fail
Differential Revision: https://phab.mercurial-scm.org/D10110
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 03 Mar 2021 19:47:48 +0100 |
parents | 1f55cd5b292f |
children | 12d59eec7f1d |
comparison
equal
deleted
inserted
replaced
46743:dfd35823635b | 46744: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> { |