Merge pull request #3655 from Tibsfox/fix/connection-error-transient
fix(gsd): classify plain 'Connection error.' as transient for auto-mode retry
This commit is contained in:
commit
e7dc2d4bd2
2 changed files with 8 additions and 1 deletions
|
|
@ -47,7 +47,7 @@ const RATE_LIMIT_RE = /rate.?limit|too many requests|429/i;
|
|||
const NETWORK_RE = /network|ECONNRESET|ETIMEDOUT|ECONNREFUSED|socket hang up|fetch failed|connection.*reset|dns/i;
|
||||
const SERVER_RE = /internal server error|500|502|503|overloaded|server_error|api_error|service.?unavailable/i;
|
||||
// ECONNRESET/ECONNREFUSED are in NETWORK_RE (same-model retry first).
|
||||
const CONNECTION_RE = /terminated|connection.?refused|other side closed|EPIPE|network.?(?:is\s+)?unavailable|stream_exhausted(?:_without_result)?/i;
|
||||
const CONNECTION_RE = /terminated|connection.?(?:refused|error)|other side closed|EPIPE|network.?(?:is\s+)?unavailable|stream_exhausted(?:_without_result)?/i;
|
||||
// Catch-all for V8 JSON.parse errors: all modern variants end with "in JSON at position \d+".
|
||||
// This eliminates the need to enumerate every error message variant individually.
|
||||
const STREAM_RE = /in JSON at position \d+|Unexpected end of JSON|SyntaxError.*JSON/i;
|
||||
|
|
|
|||
|
|
@ -101,6 +101,13 @@ test("classifyError detects quota exceeded as permanent", () => {
|
|||
assert.ok(!isTransient(result));
|
||||
});
|
||||
|
||||
test("classifyError treats plain 'Connection error.' as transient connection failure (#3594)", () => {
|
||||
const result = classifyError("Connection error.");
|
||||
assert.ok(isTransient(result));
|
||||
assert.equal(result.kind, "connection");
|
||||
assert.ok("retryAfterMs" in result && result.retryAfterMs === 15_000);
|
||||
});
|
||||
|
||||
test("classifyError treats unknown error as not transient", () => {
|
||||
const result = classifyError("something went wrong");
|
||||
assert.ok(!isTransient(result));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue