cp_cli_platform_leetcode/
error.rs1#[derive(Debug, thiserror::Error)]
2pub enum Error {
3 #[error("invalid LeetCode problem slug")]
4 InvalidSlug,
5 #[error("search query must contain 1 to 100 printable ASCII characters")]
6 InvalidQuery,
7 #[error("tag must contain 1 to 64 ASCII letters, digits, or internal hyphens")]
8 InvalidTag,
9 #[error(
10 "LeetCode session and CSRF credentials must contain 1 to 4096 printable ASCII characters"
11 )]
12 InvalidCredentials,
13 #[error("source must contain 1 to 1048576 bytes")]
14 InvalidSource,
15 #[error("test input must contain 1 to 1048576 bytes and no NUL characters")]
16 InvalidTestInput,
17 #[error("language must contain 1 to 32 lowercase ASCII letters or digits")]
18 InvalidLanguage,
19 #[error("could not complete the LeetCode request; check your connection and try again")]
20 Transport(#[from] reqwest::Error),
21 #[error("LeetCode returned HTTP {0}")]
22 Status(reqwest::StatusCode),
23 #[error("LeetCode authentication failed; refresh your session and CSRF credentials")]
24 Authentication,
25 #[error("LeetCode response exceeded {limit} bytes")]
26 ResponseTooLarge { limit: usize },
27 #[error("LeetCode returned JSON that cp-cli could not read: {0}")]
28 Decode(#[from] serde_json::Error),
29 #[error("LeetCode rejected the problem query")]
30 Graphql,
31 #[error("problem not found; use the slug from its LeetCode URL, such as two-sum")]
32 NotFound,
33 #[error("this problem requires a LeetCode Premium session")]
34 PremiumRequired,
35 #[error("LeetCode does not permit remote runs for this problem")]
36 RunUnavailable,
37 #[error("LeetCode rejected the test run: {0}")]
38 RunRejected(Box<str>),
39 #[error("LeetCode returned incompatible example-test data")]
40 InvalidTestCases,
41 #[error("LeetCode returned an incompatible test-run result")]
42 InvalidTestResult,
43 #[error("LeetCode returned an incompatible submission result")]
44 InvalidSubmissionResult,
45 #[error("LeetCode returned incomplete or inconsistent problem data")]
46 InvalidResponse,
47}