diff --git a/src/err.rs b/src/err.rs index 5f007e9..344cf1b 100644 --- a/src/err.rs +++ b/src/err.rs @@ -19,6 +19,7 @@ pub enum Error { DecryptError, SilentError, NoneError, + ChromeNotLogin, } impl std::fmt::Debug for Error { @@ -57,7 +58,8 @@ impl std::fmt::Debug for Error { Error::NoneError => write!(f, "json from response parse failed, please open a new issue at: {}.", "https://github.com/clearloop/leetcode-cli/".underline(), - ) + ), + Error::ChromeNotLogin => write!(f, "maybe you not login on the Chrome, you can login and retry.") } } } diff --git a/src/plugins/chrome.rs b/src/plugins/chrome.rs index 20ba976..8893999 100644 --- a/src/plugins/chrome.rs +++ b/src/plugins/chrome.rs @@ -85,10 +85,10 @@ pub fn cookies() -> Result { } Ok(Ident { - csrf: m.get("csrftoken").ok_or(Error::NoneError)?.to_string(), + csrf: m.get("csrftoken").ok_or(Error::ChromeNotLogin)?.to_string(), session: m .get("LEETCODE_SESSION") - .ok_or(Error::NoneError)? + .ok_or(Error::ChromeNotLogin)? .to_string(), }) }