remote_files/
error.rs

1use std::io;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum Client {
6    #[error("error while initializing client: {}", 0)]
7    Initialization(opendal::Error),
8    #[error("unhandled error: {}", 0)]
9    Unhandled(opendal::Error),
10    #[error("unknown entry mode for path '{}'", 0)]
11    StatUnknownMode(String),
12    #[error("path '{}' is not a directory", 0)]
13    ListNotDirectory(String),
14    #[error("invalid metadata for path '{}'", 0)]
15    ListMetadata(String, opendal::Error),
16    #[error("cannot download resource: {}", 0)]
17    Download(opendal::Error),
18    #[error("invalid path {}", 0)]
19    UploadInvalidFilePath(String),
20    #[error("cannot find file: {}", 0)]
21    UploadFileNotFound(io::Error),
22    #[error("error while reading file {}", 0)]
23    UploadLoad(String, io::Error),
24    #[error("cannot write to path {}", 0)]
25    UploadWrite(String, opendal::Error),
26    #[error("cannot delete path {}: {}", path, error)]
27    Delete { path: String, error: opendal::Error },
28}
29
30#[derive(Debug, Error)]
31pub enum StoredError {
32    #[error("{}", 0)]
33    Initialization(String),
34    #[error(transparent)]
35    IO(#[from] io::Error),
36    #[error("{:?}", 0)]
37    JSON(#[from] serde_json::Error),
38}