1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::{path::PathBuf, sync::mpsc};

#[derive(Debug, thiserror::Error)]
pub enum ThreadedIoError {
    #[error(transparent)]
    Std(#[from] std::io::Error),

    #[error("failed to send result path: {0}")]
    Send(#[from] mpsc::SendError<Option<PathBuf>>),

    #[error("failed to receive result path: {0}")]
    Receive(#[from] mpsc::RecvError),

    #[error("failed to join copy thread")]
    Join(Box<dyn std::any::Any + Send + 'static>),

    #[error("received an null path buffer")]
    NoPath,
}

#[derive(Debug, thiserror::Error)]
pub enum AsyncIoError {
    #[error(transparent)]
    Std(#[from] std::io::Error),

    #[error(transparent)]
    ResponseStream(#[from] reqwest::Error),
}