nure_tools/
errors.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum RequestError {
5    #[error("Can't get any response")]
6    GetFailed,
7
8    #[error("Got respond not in json format")]
9    NotJson,
10
11    #[error("API returned data in unexpexted format")]
12    InvalidReturn,
13
14    #[error("API returned with statuscode: {0} - {1}")]
15    BadResponse(String, u16),
16}
17
18#[derive(Debug, Error)]
19pub enum FindError {
20    #[error("Can't find group with name: {0}")]
21    InvalidGroupName(String),
22
23    #[error("Can't find lecture room with name: {0}")]
24    InvalidLectureRoomName(String),
25
26    #[error("Can't find teacher with name: {0}")]
27    InvalidTeacherName(String),
28
29    #[error("Can't compile Regex from given string: {0}")]
30    InvalidRegexString(String),
31}
32
33#[derive(Debug, Error)]
34pub enum ParseError {
35    #[error("Can't parse DateTime from string: {0}")]
36    InvalidStringProvided(String),
37
38    #[error("Can't parse DateTime from timestamp: {0}")]
39    InvalidTimestampProvided(String),
40}