Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a098299

Browse files
committed
feat: Add new err handler
1 parent af057b8 commit a098299

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

‎Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "leetcoderustapi"
3-
version = "1.0.2"
3+
version = "1.0.3"
44
authors = ["Kirill Melkozerov <k.melkozerov@gmail.com>"]
55
edition = "2021"
66
license = "MIT"

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This Rust library provides a convenient way to interact with the LeetCode API, a
1111
Add the following line to your `Cargo.toml` file:
1212
```toml
1313
[dependencies]
14-
leetcoderustapi = "1.0.0"
14+
leetcoderustapi = "1.0.3"
1515
```
1616
## Usage
1717
### Authentication

‎src/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ pub enum Errors {
88
FetchProblemError(#[from] reqwest::Error),
99
#[error("ApiError(`{0}`)")]
1010
ApiError(String),
11+
#[error("Sendrror(`{0}`)")]
12+
SendError(String)
1113
}
1214

1315
impl std::convert::From<Errors> for io::Error {

‎src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,5 @@ pub enum ProgrammingLanguage {
325325
Dart,
326326
Pandas,
327327
React,
328+
ADas,
328329
}

‎src/problem_actions.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ impl Problem {
6363
.await?;
6464
if status.state == "SUCCESS" {
6565
return Ok(status);
66+
} else if status.state == "FAILURE" {
67+
return Err(Errors::SendError("Sent code failure. Err may be occured by Unsupported lang for this problem".into()));
6668
}
6769
tokio::time::sleep(Duration::from_secs(1)).await;
6870
}
@@ -101,6 +103,8 @@ impl Problem {
101103
.await?;
102104
if status.state == "SUCCESS" {
103105
return Ok(status);
106+
} else if status.state == "FAILURE" {
107+
return Err(Errors::SendError("Sent code failure. Err may be occured by Unsupported lang for this problem".into()));
104108
}
105109
tokio::time::sleep(Duration::from_secs(1)).await;
106110
}
@@ -130,6 +134,7 @@ impl Problem {
130134
ProgrammingLanguage::Dart => "dart",
131135
ProgrammingLanguage::Pandas => "pandas",
132136
ProgrammingLanguage::React => "react",
137+
ProgrammingLanguage::ADas => "safa"
133138
}
134139
}
135140
pub fn code_snippets(&self) -> Option<Vec<CodeSnippetNode>> {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /