pkgctl/
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
// Copyright 2019 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_pkg_ext::BlobIdParseError;
use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
    #[error("{}", _0)]
    Json(serde_json::Error),

    #[error("{}", _0)]
    BlobId(BlobIdParseError),
}

impl From<serde_json::Error> for Error {
    fn from(err: serde_json::Error) -> Error {
        Error::Json(err)
    }
}

impl From<BlobIdParseError> for Error {
    fn from(err: BlobIdParseError) -> Error {
        Error::BlobId(err)
    }
}