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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
use crate::iotools; use graph_error::GraphError; #[derive(Debug, thiserror::Error)] #[allow(clippy::large_enum_variant)] pub enum BlockingDownloadError { #[error(transparent)] Io(#[from] iotools::ThreadedIoError), #[error("target directory does not exist {0}")] TargetDoesNotExist(String), #[error("request error: {0}")] Request(#[from] reqwest::Error), #[error("graph error: {0}")] Graph(#[from] GraphError), #[error( "file name is too long (max {} chars)", super::client::MAX_FILE_NAME_LEN )] FileNameTooLong, #[error("could not determine file name")] NoFileName, #[error( "Download file already exists: {0}. \ If you want to over write this file then use overwrite_existing_file(true)" )] FileExists(String), } impl From<std::io::Error> for BlockingDownloadError { fn from(err: std::io::Error) -> Self { Self::Io(iotools::ThreadedIoError::Std(err)) } } #[derive(Debug, thiserror::Error)] #[allow(clippy::large_enum_variant)] pub enum AsyncDownloadError { #[error(transparent)] Io(#[from] iotools::AsyncIoError), #[error("target directory does not exist {0}")] TargetDoesNotExist(String), #[error("request error: {0}")] Request(#[from] reqwest::Error), #[error("graph error: {0}")] Graph(#[from] GraphError), #[error( "file name is too long (max {} chars)", super::client::MAX_FILE_NAME_LEN )] FileNameTooLong, #[error("could not determine file name")] NoFileName, #[error( "Download file already exists: {0}. \ If you want to over write this file then use overwrite_existing_file(true)" )] FileExists(String), } impl From<std::io::Error> for AsyncDownloadError { fn from(err: std::io::Error) -> Self { Self::Io(iotools::AsyncIoError::Std(err)) } }