Skip to content

Commit d7266be

Browse files
committed
Better OpenRouter error handling
1 parent 3860abf commit d7266be

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/tender-cycles-help.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Better OpenRouter error handling

src/core/Cline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ export class Cline {
10101010
} catch (error) {
10111011
// 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.
10121012
if (alwaysApproveResubmit) {
1013-
const errorMsg = error.message ?? "Unknown error"
1013+
const errorMsg = error.error?.metadata?.raw ?? error.message ?? "Unknown error"
10141014
const baseDelay = requestDelaySeconds || 5
10151015
const exponentialDelay = Math.ceil(baseDelay * Math.pow(2, retryAttempt))
10161016
// Wait for the greater of the exponential delay or the rate limit delay

0 commit comments

Comments
 (0)