Skip to content

Commit 68577a5

Browse files
authored
fix: Improve quota breach error message for better user experience (#2263)
* revise quota err msg * mark unused variables
1 parent 00286fb commit 68577a5

File tree

1 file changed

+17
-1
lines changed
  • crates/chat-cli/src/cli/chat

1 file changed

+17
-1
lines changed

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,23 @@ impl ChatSession {
737737

738738
return Ok(());
739739
},
740-
ApiClientError::QuotaBreach { message, .. } => (message, Report::from(err), true),
740+
ApiClientError::QuotaBreach {
741+
message: _,
742+
status_code: _,
743+
} => {
744+
let err = "Request quota exceeded. Please wait a moment and try again.".to_string();
745+
self.conversation.append_transcript(err.clone());
746+
execute!(
747+
self.stderr,
748+
style::SetAttribute(Attribute::Bold),
749+
style::SetForegroundColor(Color::Red),
750+
style::Print(" ⚠️ Amazon Q rate limit reached:\n"),
751+
style::Print(format!(" {}\n\n", err.clone())),
752+
style::SetAttribute(Attribute::Reset),
753+
style::SetForegroundColor(Color::Reset),
754+
)?;
755+
("Amazon Q is having trouble responding right now", eyre!(err), false)
756+
},
741757
ApiClientError::ModelOverloadedError { request_id, .. } => {
742758
let err = format!(
743759
"The model you've selected is temporarily unavailable. Please use '/model' to select a different model and try again.{}\n\n",

0 commit comments

Comments
 (0)