Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 20, 2025

Fix swapped parameters for promiseExec and callback functions

This PR addresses issue #1042 where callback functions throughout AlaSQL use non-standard callback parameter orders.

Changes Made:

  • Create test1042.js to demonstrate current behavior and test the fix
  • Update promiseExec in src/18promise.js to expect (err, data) callback
  • Update promiseExec in src/99worker-start.js to expect (err, data) callback
  • Update alasql.exec error handling in src/17alasql.js to use (err, data)
  • Update adrunone function in src/17alasql.js to handle (err, data)
  • Update test files to use (err, data) callback pattern
  • Distinguish between internal query callbacks (res, err) and external callbacks (err, data)
  • Fix remaining callback issues in INTO functions and other internal components
  • Run all tests to ensure backward compatibility
  • Verify promise functionality works correctly with the fix

Known Issues:

  • Internal query callbacks use (res, err) pattern while external callbacks use (err, data)
  • Need to carefully distinguish between the two patterns in the codebase
  • Some INTO functions may need special handling
Original prompt

This section details on the original issue you should resolve

<issue_title>Swapped parameters for promiseExec</issue_title>
<issue_description>promiseExec has the err and data parameter swapped. This trickles down into alasql.exec and further.

Spawned from https://github.com/elipalmer/alasql/blob/3f996ea8eaf774f380a069d493518e3ea27c70a2/src/40select.js#L371</issue_description>

<agent_instructions>Please start by making a test file named test1042.js and demonstrate the use of promiseExec - and then try to refactor as described here. </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@mathiasrw Hi @alphagamer7

That would be so lovely if you could look into this.

Where are you in the process? Are you able to get to step 6 of https://github.com/agershun/alasql/blob/develop/.github/CONTRIBUTING.md ?</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

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.

Swapped parameters for promiseExec

2 participants