pkgctl/error.rs
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.
4
5use fidl_fuchsia_pkg_ext::BlobIdParseError;
6use thiserror::Error;
7
8#[derive(Debug, Error)]
9pub enum Error {
10 #[error("{}", _0)]
11 Json(serde_json::Error),
12
13 #[error("{}", _0)]
14 BlobId(BlobIdParseError),
15}
16
17impl From<serde_json::Error> for Error {
18 fn from(err: serde_json::Error) -> Error {
19 Error::Json(err)
20 }
21}
22
23impl From<BlobIdParseError> for Error {
24 fn from(err: BlobIdParseError) -> Error {
25 Error::BlobId(err)
26 }
27}