cp_cli_platform_codeforces/
error.rs1#[derive(Debug, thiserror::Error)]
2pub enum Error {
3 #[error("contest ID must be greater than zero")]
4 InvalidContestId,
5 #[error("problem index must contain 1 to 16 ASCII letters or digits")]
6 InvalidIndex,
7 #[error(
8 "Codeforces handle must contain 1 to 24 ASCII letters, digits, underscores, or hyphens"
9 )]
10 InvalidHandle,
11 #[error("submission count must be between 1 and 100")]
12 InvalidSubmissionCount,
13 #[error("blog entry ID must be greater than zero")]
14 InvalidBlogEntryId,
15 #[error(
16 "Codeforces API key must contain 1 to 128 ASCII letters, digits, underscores, or hyphens"
17 )]
18 InvalidApiKey,
19 #[error(
20 "Codeforces API secret must contain 1 to 128 ASCII letters, digits, underscores, or hyphens"
21 )]
22 InvalidApiSecret,
23 #[error("the system clock is before the Unix epoch")]
24 Clock,
25 #[error("could not create a Codeforces API signature nonce")]
26 SignatureNonce,
27 #[error("could not complete the Codeforces request; check your connection and try again")]
28 Transport(#[from] reqwest::Error),
29 #[error("Codeforces returned HTTP {0}")]
30 Status(reqwest::StatusCode),
31 #[error("Codeforces response exceeded {limit} bytes")]
32 ResponseTooLarge { limit: usize },
33 #[error("Codeforces returned JSON that cp-cli could not read: {0}")]
34 Decode(#[from] serde_json::Error),
35 #[error("Codeforces rejected the request")]
36 ApiFailure,
37 #[error("problem {contest_id}/{index} was not found on Codeforces")]
38 NotFound { contest_id: u32, index: Box<str> },
39}