-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
sqlite: improve error reporting for prepared statements in SQLTagStore #60227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
|
||
test('failed prepares throw', () => { | ||
assert.throws(() => { | ||
sql.all`SELECT * FROM does_not_exist`; // eslint-disable-line no-unused-expressions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider configuring eslint with https://eslint.org/docs/latest/rules/no-unused-expressions#allowtaggedtemplates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the ESLint configuration.
src/node_sqlite.cc
Outdated
Local<String> js_errstr; | ||
Local<String> js_errmsg; | ||
Local<Object> e; | ||
if (!String::NewFromUtf8(isolate, errstr).ToLocal(&js_errmsg) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to be swapped.
if (!String::NewFromUtf8(isolate, errstr).ToLocal(&js_errmsg) || | |
if (!String::NewFromUtf8(isolate, errstr).ToLocal(&js_errstr) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, that was my mistake.
message: 'Failed to prepare statement', | ||
code: 'ERR_SQLITE_ERROR', | ||
errcode: 1, | ||
errstr: 'no such table: does_not_exist', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong way around I think, see other comment.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60227 +/- ##
==========================================
- Coverage 88.56% 88.56% -0.01%
==========================================
Files 704 704
Lines 208125 208160 +35
Branches 40003 40013 +10
==========================================
+ Hits 184332 184361 +29
- Misses 15809 15812 +3
- Partials 7984 7987 +3
🚀 New features to boost your workflow:
|
Fixes: #60198
I added report content for SQLTagStore.
Although the text in errstr differs from that of a conventional prepared statement, it now matches the corresponding SQLite function name.