Repository navigation
fix: give execute() the last error when the server sends several - #1989
Merged
Merged
Conversation
When the server sends two or more errors for a request, tedious 15+ calls the request back with one AggregateError that holds them all. query() matched each error in it with the errors that the connection had emitted. execute() compared only the message of the AggregateError, which is empty, so it added the AggregateError as one more error. So execute(), and execute() of a prepared statement, rejected with an error that had an empty message, and the last error from the server was in precedingErrors. A stream emitted the AggregateError as an extra error with an empty message. query() and execute() now use one method, which compares each error in the AggregateError with the error in the same position. It finds that position before it adds an error, so an error that does not match does not move the others. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 12.8.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does:
When the server sends two or more errors for a request, tedious 15+ calls the request back with one
AggregateErrorthat holds them all.query()already matched each error in it with the errors that the connection had emitted.execute()compared only the message of theAggregateError, which is empty, so it added theAggregateErroras one more error.So on tedious,
request.execute()andpreparedStatement.execute()rejected with an error that had an empty message, and the real last error was inprecedingErrors. In stream mode the request emitted an extraerrorevent with an empty message. For example, a procedure that runsraiserror('first', 16, 1); raiserror('second', 16, 1):execute()rejects with'''second'precedingErrors['first', 'second']['first']errorevents'first','second','''first','second'query()andexecute()now use one method to add the error from tedious's callback. It finds the position of the reported errors once, before it adds any, so an error that does not match does not move the others.Unit tests cover
query()andexecute()with a fake tedious connection. A new integration test coversexecute(), a stream and a prepared statement on tedious. I rannpm run test-tediouson tedious 19.2.2 and 20.4.3.Related issues:
Found in the review of #1980. It does not need a value handler, and it was already on master.
Pre/Post merge checklist:
🤖 Generated with Claude Code