Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/errors.rs @ 46799:bcdcb4423ae3
rhg: Add more conversions between error types
This allows using the `?` operator in more places, as the next commit does.
Differential Revision: https://phab.mercurial-scm.org/D10238
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 19 Mar 2021 13:18:53 +0100 |
parents | 97ac588b6d9e |
children | 6e49769b7f97 |
line wrap: on
line diff
--- a/rust/hg-core/src/errors.rs Fri Mar 19 23:51:46 2021 +0100 +++ b/rust/hg-core/src/errors.rs Fri Mar 19 13:18:53 2021 +0100 @@ -88,25 +88,7 @@ HgError::UnsupportedFeature(explanation) => { write!(f, "unsupported feature: {}", explanation) } - HgError::ConfigValueParseError(ConfigValueParseError { - origin: _, - line: _, - section, - item, - value, - expected_type, - }) => { - // TODO: add origin and line number information, here and in - // corresponding python code - write!( - f, - "config error: {}.{} is not a {} ('{}')", - String::from_utf8_lossy(section), - String::from_utf8_lossy(item), - expected_type, - String::from_utf8_lossy(value) - ) - } + HgError::ConfigValueParseError(error) => error.fmt(f), } } }