swimlane/
error.rs

1use reqwest::Error as ReqwestError;
2use thiserror::Error;
3use tokio::io;
4
5#[derive(Error, Debug)]
6pub enum SwimlaneClientError {
7    // #[error("data store disconnected")]
8    // Disconnect(#[from] io::Error),
9    // #[error("the data for key `{0}` is not available")]
10    // Redaction(String),
11    // #[error("invalid header (expected {expected:?}, found {found:?})")]
12    // InvalidHeader {
13    //     expected: String,
14    //     found: String,
15    // },
16    #[error("Python Package Not Found {package:?} {version:?}")]
17    PackageNotFound { package: String, version: String },
18    #[error("File not found {0}")]
19    FileNotFound(String),
20    #[error("IO Error")]
21    IoError(#[from] io::Error),
22    #[error("Request Error")]
23    ReqwestError(#[from] ReqwestError),
24    #[error("Parse Error")]
25    ParseError(#[from] url::ParseError),
26    #[error("Decoding Error")]
27    DeserializationError(#[from] serde_json::Error),
28}
29
30#[derive(Debug, Clone)]
31pub struct InvalidFormat;
32
33#[derive(Debug, Error)]
34pub enum UploadRequirementsError {
35    #[error("File not found")]
36    FileNotFound(#[from] io::Error),
37    // #[error("I/O error")]
38    // Io(#[from] io::Error),
39    #[error("File isn't in the correct format")]
40    InvalidFormat { line_number: usize, line: String },
41    #[error("Package has been specified twice: {key} on line {line_number} with value {existing_value} and {new_value}")]
42    DuplicatePackage {
43        key: String,
44        line_number: usize,
45        existing_value: String,
46        new_value: String,
47    },
48}