Skip to content

Commit 3271ba5

Browse files
committed
fix(openrouter): prefix HTTP status in error message so isRetryableError catches 402/429
1 parent 98673e6 commit 3271ba5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/core/llm/providers/implementations/OpenRouterProvider.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,12 @@ export class OpenRouterProvider implements IProvider {
685685
errorMessage = error.message;
686686
}
687687

688+
// Prefix the status code into the message so downstream retry/fallback
689+
// logic (e.g. isRetryableError, which greps for \b402\b) can route on it
690+
// even when the OR API body provides a friendlier description.
691+
const decoratedMessage = statusCode ? `[${statusCode}] ${errorMessage}` : errorMessage;
688692
throw new OpenRouterProviderError(
689-
errorMessage,
693+
decoratedMessage,
690694
'API_REQUEST_FAILED',
691695
statusCode,
692696
errorType,

0 commit comments

Comments
 (0)