1// Copyright 2019 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
45use thiserror::Error;
6use zx_status as zx;
78#[allow(missing_docs)]
9#[derive(Error, Debug, PartialEq, Eq)]
10pub enum RuleParseError {
11#[error("invalid hostname")]
12InvalidHost,
1314#[error("paths must start with '/'")]
15InvalidPath,
1617#[error("paths should both be a prefix match or both be a literal match")]
18InconsistentPaths,
19}
2021#[allow(missing_docs)]
22#[derive(Error, Debug, PartialEq, Eq)]
23pub enum RuleDecodeError {
24#[error("unknown variant")]
25UnknownVariant,
2627#[error("parse error: {}", _0)]
28ParseError(RuleParseError),
29}
3031impl From<RuleParseError> for RuleDecodeError {
32fn from(x: RuleParseError) -> Self {
33 RuleDecodeError::ParseError(x)
34 }
35}
3637#[allow(missing_docs)]
38#[derive(Debug, Error)]
39pub enum EditTransactionError {
40#[error("internal fidl error")]
41Fidl(#[from] fidl::Error),
4243#[error("commit error")]
44CommitError(#[source] zx::Status),
4546#[error("add error")]
47AddError(#[source] zx::Status),
4849#[error("rule decode error")]
50RuleDecodeError(#[from] RuleDecodeError),
51}