From d7266be3feb018c5bf207135cb54f74c94d198e5 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Wed, 26 Feb 2025 13:52:38 -0500 Subject: [PATCH] Better OpenRouter error handling --- .changeset/tender-cycles-help.md | 5 +++++ src/core/Cline.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/tender-cycles-help.md diff --git a/.changeset/tender-cycles-help.md b/.changeset/tender-cycles-help.md new file mode 100644 index 0000000000..d43e423ee6 --- /dev/null +++ b/.changeset/tender-cycles-help.md @@ -0,0 +1,5 @@ +--- +"roo-cline": patch +--- + +Better OpenRouter error handling diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 073bd10911..2e29ad453c 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -1010,7 +1010,7 @@ export class Cline { } catch (error) { // note that this api_req_failed ask is unique in that we only present this option if the api hasn't streamed any content yet (ie it fails on the first chunk due), as it would allow them to hit a retry button. However if the api failed mid-stream, it could be in any arbitrary state where some tools may have executed, so that error is handled differently and requires cancelling the task entirely. if (alwaysApproveResubmit) { - const errorMsg = error.message ?? "Unknown error" + const errorMsg = error.error?.metadata?.raw ?? error.message ?? "Unknown error" const baseDelay = requestDelaySeconds || 5 const exponentialDelay = Math.ceil(baseDelay * Math.pow(2, retryAttempt)) // Wait for the greater of the exponential delay or the rate limit delay