Mercurial > hg
comparison rust/hg-core/src/lib.rs @ 47335:ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
When parsing becomes lazy, parse error will potentially happen in more places.
This propagates such errors to callers.
Differential Revision: https://phab.mercurial-scm.org/D10749
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 19 May 2021 13:15:00 +0200 |
parents | 5d62243c7732 |
children | 6e49769b7f97 |
comparison
equal
deleted
inserted
replaced
47334:18b3060fe598 | 47335:ed1583a845d2 |
---|---|
81 pub enum DirstateError { | 81 pub enum DirstateError { |
82 Map(DirstateMapError), | 82 Map(DirstateMapError), |
83 Common(errors::HgError), | 83 Common(errors::HgError), |
84 } | 84 } |
85 | 85 |
86 impl fmt::Display for DirstateError { | |
87 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
88 match self { | |
89 DirstateError::Map(error) => error.fmt(f), | |
90 DirstateError::Common(error) => error.fmt(f), | |
91 } | |
92 } | |
93 } | |
94 | |
86 #[derive(Debug, derive_more::From)] | 95 #[derive(Debug, derive_more::From)] |
87 pub enum PatternError { | 96 pub enum PatternError { |
88 #[from] | 97 #[from] |
89 Path(HgPathError), | 98 Path(HgPathError), |
90 UnsupportedSyntax(String), | 99 UnsupportedSyntax(String), |