aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crates/atuin-client/src/api_client.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/atuin-client/src/api_client.rs b/crates/atuin-client/src/api_client.rs
index f31a796e..7481c39a 100644
--- a/crates/atuin-client/src/api_client.rs
+++ b/crates/atuin-client/src/api_client.rs
@@ -86,6 +86,10 @@ pub async fn login(address: &str, req: LoginRequest) -> Result<LoginResponse> {
.send()
.await?;
+ if resp.status() == StatusCode::TOO_MANY_REQUESTS {
+ bail!("Rate limited. Too many login attempts.");
+ }
+
if !ensure_version(&resp)? {
bail!("could not login due to version mismatch");
}
@@ -157,6 +161,10 @@ async fn handle_resp_error(resp: Response) -> Result<Response> {
);
}
+ if status == StatusCode::TOO_MANY_REQUESTS {
+ bail!("Rate limited; please wait before doing that again");
+ }
+
if !status.is_success() {
if let Ok(error) = resp.json::<ErrorResponse>().await {
let reason = error.reason;