realm_client/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2024 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use fidl_fuchsia_component as fcomponent;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error(
        "namespace {prefix} should have exactly one entry but it has {count}. This suggests a \
        bug in the namespace protocol."
    )]
    InvalidNamespaceEntryCount { prefix: String, count: usize },

    #[error("namespace creation failed: {0:?}")]
    NamespaceCreation(fcomponent::NamespaceError),

    #[error("the namespace is not installed: {0:?}")]
    NamespaceNotInstalled(#[source] zx::Status),

    #[error("binding the namespace failed: {0:?}")]
    NamespaceBind(#[source] zx::Status),

    #[error(
        "namespace {prefix} contains incomplete entry. This suggests a bug in the namespace \
            protocol {message}"
    )]
    EntryIncomplete { prefix: String, message: String },

    #[error(
        "namespace {prefix} does not match path. This suggests a bug in the namespace protocol. \
            Path was {path}"
    )]
    PrefixDoesNotMatchPath { prefix: String, path: String },

    #[error("failed to connect to protocol: {0}")]
    ConnectionFailed(String),

    #[error("fidl error")]
    Fidl(#[from] fidl::Error),

    #[error("operation failed: {0:?}")]
    OperationError(fidl_fuchsia_testing_harness::OperationError),
}