fetch_url/
errors.rs

1// Copyright 2025 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 thiserror::Error;
6
7#[derive(Debug, Error)]
8pub enum FetchUrlError {
9    #[error("connecting to http service")]
10    FidlHttpServiceConnectionError(#[source] anyhow::Error),
11
12    #[error("calling Loader::Fetch")]
13    LoaderFIDLError(#[from] fidl::Error),
14
15    #[error("reading URL body")]
16    UrlReadBodyError,
17
18    #[error("reading data from socket")]
19    ReadFromSocketError(#[source] std::io::Error),
20
21    #[error("LoaderProxy error: '{0:?}'")]
22    LoaderFetchError(fidl_fuchsia_net_http::Error),
23
24    #[error("no HTTP status response")]
25    NoStatusResponse,
26
27    #[error("unexpected http status code {0}")]
28    UnexpectedHttpStatusCode(u32),
29
30    #[error("read size mismatch, expected {0},  got {1}")]
31    SizeReadMismatch(u64, u64),
32}