Skip to content

Commit f53f5eb

Browse files
authored
chore: friendly error tips (#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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy