driver_manager_utils/
errors.rs1use fidl_fuchsia_component_sandbox as fsandbox;
6use thiserror::Error;
7
8#[derive(Debug, Error)]
9pub enum UtilsError {
10 #[error("FIDL error: {0}")]
11 Fidl(#[from] fidl::Error),
12 #[error("Unexpected capability type. Wanted: {0}, got: {1}")]
13 UnexpectedCapabilityType(String, String),
14 #[error("Unexpected routed type")]
15 UnexpectedRoutedType,
16 #[error("Sandbox error: {0}")]
17 SandboxError(String),
18 #[error("zx error: {0}")]
19 ZxStatus(zx::Status),
20}
21
22impl From<fsandbox::CapabilityStoreError> for UtilsError {
23 fn from(err: fsandbox::CapabilityStoreError) -> Self {
24 UtilsError::SandboxError(format!("CapabilityStoreError: {:?}", err))
25 }
26}
27
28impl From<fsandbox::RouterError> for UtilsError {
29 fn from(err: fsandbox::RouterError) -> Self {
30 UtilsError::SandboxError(format!("RouterError: {:?}", err))
31 }
32}
33
34impl From<i32> for UtilsError {
35 fn from(err: i32) -> Self {
36 UtilsError::ZxStatus(zx::Status::from_raw(err))
37 }
38}