Skip to content

fix(pg): emit query error even when callback is present - #3811

Open
mikemasam wants to merge 1 commit into
brianc:masterfrom
mikemasam:fix/emit-error-with-callback
Open

mikemasam wants to merge 1 commit into
brianc:masterfrom
mikemasam:fix/emit-error-with-callback

Conversation

@mikemasam

Copy link
Copy Markdown

Issue: Query.handleError swallowed the 'error' event whenever
query.callback existed (always true with query_timeout or connectionParameters.query_timeout). listeners with on('error') never fired.

Fix: emit 'error' first if there are listeners, then still
invoke callback:

  • guarded by listenerCount('error') so callback/promise-only
    don't throw an unhandled-'error'.
  • preserves existing return callback(err) semantics.
  • now matches with success path (callback + 'end');

Test: unit test verifies both callback and 'error' listener fire
for the same handleError.

@mikemasam mikemasam changed the title fix(pg): emit query error even when callback is present fix: emit query error even when callback is present Oct 9, 2026
@mikemasam mikemasam changed the title fix: emit query error even when callback is present fix(pg): emit query error even when callback is present Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant