1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5 #[error("[init_firstXkkzId] 不存在,未到选课时间")]
6 NotyetStarted,
7
8 #[error("[{0}] 找不到教学班")]
9 JxbNotFound(&'static str),
10
11 #[error("[select_course] 学号长度不足")]
12 InvalidXhId,
13
14 #[error("Login failed")]
15 LoginFailed,
16
17 #[error("Missing field: {0}")]
18 Missing(String),
19
20 #[error("Missing field: {0}")]
21 MissingField(&'static str),
22
23 #[error("Reqwest error: {0}")]
24 Reqwest(#[from] reqwest::Error),
25
26 #[error("RSA error: {0}")]
27 Rsa(#[from] rsa::errors::Error),
28
29 #[error("RSA key parse error: {0}")]
30 ParseRsaKeyError(&'static str),
31
32 #[error("Base64 decode error: {0}")]
33 Base64Decode(#[from] base64::DecodeError),
34
35 #[error("System time error: {0}")]
36 SystemTime(#[from] std::time::SystemTimeError),
37}
38
39pub type R<T = ()> = Result<T, Error>;