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 f53f5eb

Browse files
chore: friendly error tips (clearloop#90)
1 parent 7ea48b8 commit f53f5eb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

‎src/err.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub enum Error {
1919
DecryptError,
2020
SilentError,
2121
NoneError,
22+
ChromeNotLogin,
2223
}
2324

2425
impl std::fmt::Debug for Error {
@@ -57,7 +58,8 @@ impl std::fmt::Debug for Error {
5758
Error::NoneError => write!(f,
5859
"json from response parse failed, please open a new issue at: {}.",
5960
"https://github.com/clearloop/leetcode-cli/".underline(),
60-
)
61+
),
62+
Error::ChromeNotLogin => write!(f, "maybe you not login on the Chrome, you can login and retry.")
6163
}
6264
}
6365
}

‎src/plugins/chrome.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ pub fn cookies() -> Result<Ident, crate::Error> {
8585
}
8686

8787
Ok(Ident {
88-
csrf: m.get("csrftoken").ok_or(Error::NoneError)?.to_string(),
88+
csrf: m.get("csrftoken").ok_or(Error::ChromeNotLogin)?.to_string(),
8989
session: m
9090
.get("LEETCODE_SESSION")
91-
.ok_or(Error::NoneError)?
91+
.ok_or(Error::ChromeNotLogin)?
9292
.to_string(),
9393
})
9494
}

0 commit comments

Comments
(0)

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