Summary
When a request is aborted while the SDK is sleeping between retries after a network error, sleep rejects with an AbortError inside the catch block where nothing catches it, so request() (and insert()/fetch()/…) rejects instead of returning { ok: false, error: { code: "ABORTED" } }.
Detail
clients/ts/src/http.ts:102-105:
lastError = networkError(e);
if (attempt < maxAttempts - 1) {
await sleep(backoff(attempt), opts.signal); // rejects on abort, uncaught
}
The 5xx / Retry-After sleeps (:78, :86) are inside the try, so an abort there is caught and mapped to the ABORTED Result; the network-error backoff sleep is in the catch, so its rejection escapes. The documented contract (types.ts:13-18) is that request never throws.
Fix direction
Wrap the catch-block sleep in its own try/catch (or check the signal) and return the ABORTED Result, matching the other two sleep sites.
Found in a repo-wide audit; verified by code trace. #198/#201 are about error types, not this.
Summary
When a request is aborted while the SDK is sleeping between retries after a network error,
sleeprejects with anAbortErrorinside thecatchblock where nothing catches it, sorequest()(andinsert()/fetch()/…) rejects instead of returning{ ok: false, error: { code: "ABORTED" } }.Detail
clients/ts/src/http.ts:102-105:The 5xx / Retry-After sleeps (
:78,:86) are inside thetry, so an abort there is caught and mapped to theABORTEDResult; the network-error backoff sleep is in thecatch, so its rejection escapes. The documented contract (types.ts:13-18) is thatrequestnever throws.Fix direction
Wrap the catch-block
sleepin its own try/catch (or check the signal) and return theABORTEDResult, matching the other two sleep sites.Found in a repo-wide audit; verified by code trace. #198/#201 are about error types, not this.