Skip to main content

cp_cli_platform_codechef/
error.rs

1#[derive(Debug, thiserror::Error)]
2pub enum Error {
3    #[error("CodeChef account names must use letters, numbers, hyphens, or underscores")]
4    InvalidHandle,
5    #[error("CodeChef Discuss topic IDs must be greater than zero")]
6    InvalidTopicId,
7    #[error("could not complete the CodeChef Discuss request; check your connection and try again")]
8    Transport(#[from] reqwest::Error),
9    #[error("CodeChef Discuss returned HTTP {0}")]
10    Status(reqwest::StatusCode),
11    #[error("CodeChef Discuss response exceeded {limit} bytes")]
12    ResponseTooLarge { limit: usize },
13    #[error("CodeChef Discuss returned JSON that cp-cli could not read: {0}")]
14    Decode(#[from] serde_json::Error),
15    #[error("CodeChef Discuss could not find that public discussion")]
16    NotFound,
17    #[error("CodeChef Discuss returned incomplete or inconsistent discussion data")]
18    InvalidResponse,
19    #[error("CodeChef returned an incomplete or inconsistent public profile")]
20    InvalidProfile,
21}