Fix sqlite custom function callback errors reporting by Charlesnorris509 · Pull Request #56773 · nodejs/node · GitHub
Skip to content

Fix sqlite custom function callback errors reporting#56773

Closed
Charlesnorris509 wants to merge 1 commit intonodejs:mainfrom
Charlesnorris509:fix-sqlite-custom-function-errors
Closed

Fix sqlite custom function callback errors reporting#56773
Charlesnorris509 wants to merge 1 commit intonodejs:mainfrom
Charlesnorris509:fix-sqlite-custom-function-errors

Conversation

@Charlesnorris509
Copy link
Copy Markdown

@Charlesnorris509 Charlesnorris509 commented Jan 26, 2025

Fixes #56772

Add error reporting for custom function callback errors to the sqlite API.

  • src/node_sqlite.cc

    • Call sqlite3_result_error() in UserDefinedFunction::xFunc when the JS callback throws an error.
    • Update the retval check to handle the error condition and call sqlite3_result_error().
  • test/parallel/test-sqlite-custom-functions.js

    • Add a new test to verify that custom function callback errors are reported to the sqlite API.
    • Write tests to ensure that error conditions in the JS callback result in sqlite3_result_error() being called.

For more details, open the Copilot Workspace session.

Fixes nodejs#56772

Add error reporting for custom function callback errors to the sqlite API.

* **src/node_sqlite.cc**
  - Call `sqlite3_result_error()` in `UserDefinedFunction::xFunc` when the JS callback throws an error.
  - Update the `retval` check to handle the error condition and call `sqlite3_result_error()`.

* **test/parallel/test-sqlite-custom-functions.js**
  - Add a new test to verify that custom function callback errors are reported to the sqlite API.
  - Write tests to ensure that error conditions in the JS callback result in `sqlite3_result_error()` being called.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/nodejs/node/issues/56772?shareId=XXXX-XXXX-XXXX-XXXX).
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem. labels Jan 26, 2025
@cjihrig
Copy link
Copy Markdown
Contributor

cjihrig commented Jan 26, 2025

@cjihrig
Copy link
Copy Markdown
Contributor

cjihrig commented Jan 26, 2025

For reference, I think the fix should look more like this - cjihrig@f113c39. Note, I already had this patch mostly written when I saw your PR.

@Charlesnorris509
Copy link
Copy Markdown
Author

Thanks for letting me know that this issue has been previously resolved

@cjihrig
Copy link
Copy Markdown
Contributor

cjihrig commented Jan 28, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sqlite: custom function callback errors should be reported to sqlite API

3 participants