hyper_client_pool/
error.rs1use std::io;
2
3use crate::deliverable::Deliverable;
4use crate::transaction::Transaction;
5
6#[derive(Debug)]
8pub enum SpawnError {
9 ThreadSpawn(io::Error),
10 HttpsConnector(native_tls::Error),
11}
12
13impl PartialEq for SpawnError {
14 fn eq(&self, other: &SpawnError) -> bool {
15 match self {
16 SpawnError::ThreadSpawn(_err) => match other {
17 SpawnError::ThreadSpawn(_oerr) => true,
18 _ => false,
19 },
20 SpawnError::HttpsConnector(_err) => match other {
21 SpawnError::HttpsConnector(_oerr) => true,
22 _ => false,
23 },
24 }
25 }
26}
27
28impl From<native_tls::Error> for SpawnError {
29 fn from(err: native_tls::Error) -> SpawnError {
30 SpawnError::HttpsConnector(err)
31 }
32}
33
34#[derive(Debug)]
36pub struct Error<D: Deliverable> {
37 pub kind: ErrorKind,
38 transaction: Transaction<D>,
39}
40
41impl<D: Deliverable> Error<D> {
42 pub(crate) fn new(kind: ErrorKind, transaction: Transaction<D>) -> Error<D> {
43 Error { kind, transaction }
44 }
45
46 pub fn into_inner(self) -> Transaction<D> {
47 self.transaction
48 }
49}
50
51#[derive(Debug, PartialEq)]
55pub enum ErrorKind {
56 Spawn(SpawnError),
58 PoolFull,
60}
61
62pub(crate) enum RequestError<D: Deliverable> {
65 PoolFull(Transaction<D>),
66 FailedSend(Transaction<D>),
67}