barter_instrument/index/error.rs
1use serde::{Deserialize, Serialize};
2use thiserror::Error;
3
4/// Represents all possible errors that can occur when searching for indexes in an
5/// [`IndexedInstruments`](super::IndexedInstruments) collection.
6#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Deserialize, Serialize, Error)]
7pub enum IndexError {
8 /// Indicates a failure to find an [`ExchangeIndex`](crate::exchange::ExchangeIndex) for a
9 /// given exchange identifier.
10 ///
11 /// Contains a description of the failed lookup attempt.
12 #[error("ExchangeIndex: {0}")]
13 ExchangeIndex(String),
14
15 /// Indicates a failure to find an [`AssetIndex`](crate::asset::AssetIndex) for a given
16 /// asset identifier.
17 ///
18 /// Contains a description of the failed lookup attempt.
19 #[error("AssetIndex: {0}")]
20 AssetIndex(String),
21
22 /// Indicates a failure to find an [`InstrumentIndex`](crate::instrument::InstrumentIndex)
23 /// for a given instrument identifier.
24 ///
25 /// Contains a description of the failed lookup attempt.
26 #[error("InstrumentIndex: {0}")]
27 InstrumentIndex(String),
28}