fidl_fuchsia_pkg_rewrite_ext/
errors.rs1use thiserror::Error;
6use zx_status as zx;
7
8#[allow(missing_docs)]
9#[derive(Error, Debug, PartialEq, Eq)]
10pub enum RuleParseError {
11 #[error("invalid hostname")]
12 InvalidHost,
13
14 #[error("paths must start with '/'")]
15 InvalidPath,
16
17 #[error("paths should both be a prefix match or both be a literal match")]
18 InconsistentPaths,
19}
20
21#[allow(missing_docs)]
22#[derive(Error, Debug, PartialEq, Eq)]
23pub enum RuleDecodeError {
24 #[error("unknown variant")]
25 UnknownVariant,
26
27 #[error("parse error: {}", _0)]
28 ParseError(RuleParseError),
29}
30
31impl From<RuleParseError> for RuleDecodeError {
32 fn from(x: RuleParseError) -> Self {
33 RuleDecodeError::ParseError(x)
34 }
35}
36
37#[allow(missing_docs)]
38#[derive(Debug, Error)]
39pub enum EditTransactionError {
40 #[error("internal fidl error")]
41 Fidl(#[from] flex_client::Error),
42
43 #[cfg(feature = "fdomain")]
44 #[error("native fidl error")]
45 NativeFidl(#[source] ::fidl::Error),
46
47 #[error("commit error")]
48 CommitError(#[source] zx::Status),
49
50 #[error("add error")]
51 AddError(#[source] zx::Status),
52
53 #[error("rule decode error")]
54 RuleDecodeError(#[from] RuleDecodeError),
55}
56
57#[cfg(feature = "fdomain")]
58impl From<::fidl::Error> for EditTransactionError {
59 fn from(e: ::fidl::Error) -> Self {
60 Self::NativeFidl(e)
61 }
62}