subxt_utils_fetchmetadata/
error.rs

1// Copyright 2019-2024 Parity Technologies (UK) Ltd.
2// This file is dual-licensed as Apache-2.0 or GPL-3.0.
3// see LICENSE for license details.
4
5/// Error attempting to fetch metadata.
6#[derive(Debug, thiserror::Error)]
7#[non_exhaustive]
8pub enum Error {
9    /// Error decoding from a hex value.
10    #[error("Cannot decode hex value: {0}")]
11    DecodeError(#[from] hex::FromHexError),
12    /// Some SCALE codec error.
13    #[error("Cannot scale encode/decode value: {0}")]
14    CodecError(#[from] codec::Error),
15    /// JSON-RPC error fetching metadata.
16    #[cfg(feature = "url")]
17    #[error("Request error: {0}")]
18    RequestError(#[from] jsonrpsee::core::ClientError),
19    /// Failed IO when fetching from a file.
20    #[error(
21        "Failed IO for {0}, make sure that you are providing the correct file path for metadata: {1}"
22    )]
23    Io(String, std::io::Error),
24    /// URL scheme is not http, https, ws or wss.
25    #[error("'{0}' not supported, supported URI schemes are http, https, ws or wss.")]
26    InvalidScheme(String),
27    /// Some other error.
28    #[error("Other error: {0}")]
29    Other(String),
30}