Skip to content

fix(repeater): always report a string errorCode for failed HTTP requests - #839

Merged
aborovsky merged 1 commit into
nextfrom
fix/repeater-string-error-code
Nov 30, 2026
Merged

aborovsky merged 1 commit into
nextfrom
fix/repeater-string-error-code

Conversation

@aborovsky

Copy link
Copy Markdown
Contributor

What

HttpRequestExecutor.execute() now always reports a string errorCode for a failed request, whatever the request fails on.

The bridges classify a failed request by a Node.js-style string errorCode (ETIMEDOUT, ECONNREFUSED, ...). #787 converts libcurl codes in curl.on('error'), but other error sources still reached the catch block in execute() unchanged:

  • A virtual script that throws an error with a numeric code was reported with that number in the ack, for example errorCode: 28.
  • A script that throws null or undefined made the catch block itself throw (Cannot destructure property 'cause'). execute() rejected, the failure only went to Sentry and the bridges never got an answer for the request.

The catch block now goes through describeFailure(err: unknown):

  • A numeric code goes through CurlErrorMapper.toErrorCode: 28 becomes ETIMEDOUT, and an unmapped code becomes its CURLE_* name.
  • syscall and name are used only when they are strings.
  • cause is used only when it is an object, otherwise the error itself is read.
  • A thrown value that is not an object gives an error response with message: String(err) and no errorCode.

WsRequestExecutor is unchanged.

Verification

  • New tests in describe('execute', ...) fail on next and pass with the fix:
    • numeric code from a script: 28 → 'ETIMEDOUT', 1 → 'CURLE_UNSUPPORTED_PROTOCOL';
    • script throws null, undefined or a string: execute() returns an error response.
  • All 371 unit tests pass, along with tsc -p tsconfig.build.json, eslint and prettier.

The bridges classify a failed request by a Node.js-style string
errorCode. libcurl codes are already converted in curl.on('error'), but
other error sources still reach the execute() catch block unchanged: a
virtual script that throws an error with a numeric code was reported
with that number, and one that throws null or undefined made execute()
reject, so the bridges never got an answer.

Run numeric codes through CurlErrorMapper.toErrorCode, take only string
values for syscall and name, and return an error response for any
thrown value.
@aborovsky aborovsky self-assigned this Nov 30, 2026
@aborovsky aborovsky added the Type: bug Something isn't working. label Nov 30, 2026
@aborovsky
aborovsky marked this pull request as ready for review November 30, 2026 13:11
@aborovsky
aborovsky merged commit 0df52b3 into next Nov 30, 2026
11 checks passed
@aborovsky
aborovsky deleted the fix/repeater-string-error-code branch November 30, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: bug Something isn't working.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants