Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export default [
'no-throw-literal': 'error',
'no-undef': ['error', { typeof: true }],
'no-undef-init': 'error',
'no-unused-expressions': ['error', { allowShortCircuit: true }],
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTaggedTemplates: true }],
'no-unused-vars': ['error', { args: 'none', caughtErrors: 'all' }],
'no-use-before-define': ['error', {
classes: true,
Expand Down
1 change: 1 addition & 0 deletions src/env_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
V(errno_string, "errno") \
V(error_string, "error") \
V(errstr_string, "errstr") \
V(errmsg_string, "errmsg") \
V(events_waiting, "eventsWaiting") \
V(events, "events") \
V(exclusive_string, "exclusive") \
Expand Down
47 changes: 46 additions & 1 deletion src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,35 @@ inline MaybeLocal<Object> CreateSQLiteError(Isolate* isolate, sqlite3* db) {
isolate, sqlite3_errmsg(db), sqlite3_errstr(errcode), errcode);
}

inline MaybeLocal<Object> CreateSQLiteError(Isolate* isolate,
sqlite3* db,
const char* message) {
int errcode = sqlite3_extended_errcode(db);
const char* errstr = sqlite3_errstr(errcode);
const char* errmsg = sqlite3_errmsg(db);
Local<String> js_errstr;
Local<String> js_errmsg;
Local<Object> e;
if (!String::NewFromUtf8(isolate, errstr).ToLocal(&js_errstr) ||
!String::NewFromUtf8(isolate, errmsg).ToLocal(&js_errmsg) ||
!CreateSQLiteError(isolate, message).ToLocal(&e) ||
e->Set(isolate->GetCurrentContext(),
Environment::GetCurrent(isolate)->errcode_string(),
Integer::New(isolate, errcode))
.IsNothing() ||
e->Set(isolate->GetCurrentContext(),
Environment::GetCurrent(isolate)->errstr_string(),
js_errstr)
.IsNothing() ||
e->Set(isolate->GetCurrentContext(),
Environment::GetCurrent(isolate)->errmsg_string(),
js_errmsg)
.IsNothing()) {
return MaybeLocal<Object>();
}
return e;
}

void JSValueToSQLiteResult(Isolate* isolate,
sqlite3_context* ctx,
Local<Value> value) {
Expand Down Expand Up @@ -344,6 +373,20 @@ inline void THROW_ERR_SQLITE_ERROR(Isolate* isolate, const char* message) {
}
}

inline void THROW_ERR_SQLITE_ERROR(Isolate* isolate,
DatabaseSync* db,
const char* message) {
if (db->ShouldIgnoreSQLiteError()) {
db->SetIgnoreNextSQLiteError(false);
return;
}

Local<Object> e;
if (CreateSQLiteError(isolate, db->Connection(), message).ToLocal(&e)) {
isolate->ThrowException(e);
}
}

inline void THROW_ERR_SQLITE_ERROR(Isolate* isolate, int errcode) {
const char* errstr = sqlite3_errstr(errcode);

Expand Down Expand Up @@ -3972,7 +4015,9 @@ BaseObjectPtr<StatementSync> SQLTagStore::PrepareStatement(
StatementPtr stmt_ptr(s);

if (r != SQLITE_OK) {
THROW_ERR_SQLITE_ERROR(isolate, session->database_.get());
THROW_ERR_SQLITE_ERROR(
isolate, session->database_.get(), "Failed to prepare statement");
sqlite3_finalize(s);
return BaseObjectPtr<StatementSync>();
}

Expand Down
13 changes: 13 additions & 0 deletions test/parallel/test-sqlite-template-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
assert.strictEqual(sql.run`INSERT INTO foo (text) VALUES (${'test'})`.changes, 1);

// Test with non-existent column
assert.throws(() => {

Check failure on line 302 in test/parallel/test-sqlite-template-tag.js

View workflow job for this annotation

GitHub Actions / test-macOS

--- stdout --- Test failure: 'sql error messages are descriptive' Location: test/parallel/test-sqlite-template-tag.js:298:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such column/i } at TestContext.<anonymous> (/Users/runner/work/node/node/node/test/parallel/test-sqlite-template-tag.js:302:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Test failure: 'cached statements are finalized when the database is closed' Location: test/parallel/test-sqlite-template-tag.js:375:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such table/i } at TestContext.<anonymous> (/Users/runner/work/node/node/node/test/parallel/test-sqlite-template-tag.js:386:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Command: out/Release/node --expose-gc --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /Users/runner/work/node/node/node/test/parallel/test-sqlite-template-tag.js

Check failure on line 302 in test/parallel/test-sqlite-template-tag.js

View workflow job for this annotation

GitHub Actions / test-linux (ubuntu-24.04-arm)

--- stdout --- Test failure: 'sql error messages are descriptive' Location: test/parallel/test-sqlite-template-tag.js:298:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such column/i } at TestContext.<anonymous> (/home/runner/work/node/node/node/test/parallel/test-sqlite-template-tag.js:302:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Test failure: 'cached statements are finalized when the database is closed' Location: test/parallel/test-sqlite-template-tag.js:375:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such table/i } at TestContext.<anonymous> (/home/runner/work/node/node/node/test/parallel/test-sqlite-template-tag.js:386:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Command: out/Release/node --expose-gc --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/node/node/node/test/parallel/test-sqlite-template-tag.js

Check failure on line 302 in test/parallel/test-sqlite-template-tag.js

View workflow job for this annotation

GitHub Actions / test-linux (ubuntu-24.04)

--- stdout --- Test failure: 'sql error messages are descriptive' Location: test/parallel/test-sqlite-template-tag.js:298:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such column/i } at TestContext.<anonymous> (/home/runner/work/node/node/node/test/parallel/test-sqlite-template-tag.js:302:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Test failure: 'cached statements are finalized when the database is closed' Location: test/parallel/test-sqlite-template-tag.js:375:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such table/i } at TestContext.<anonymous> (/home/runner/work/node/node/node/test/parallel/test-sqlite-template-tag.js:386:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Command: out/Release/node --expose-gc --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/node/node/node/test/parallel/test-sqlite-template-tag.js

Check failure on line 302 in test/parallel/test-sqlite-template-tag.js

View workflow job for this annotation

GitHub Actions / x86_64-linux: with shared libraries and perfetto / build

--- stdout --- Test failure: 'sql error messages are descriptive' Location: test/parallel/test-sqlite-template-tag.js:298:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such column/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:302:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Test failure: 'cached statements are finalized when the database is closed' Location: test/parallel/test-sqlite-template-tag.js:375:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such table/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:386:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Command: out/Release/node --expose-gc --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js

Check failure on line 302 in test/parallel/test-sqlite-template-tag.js

View workflow job for this annotation

GitHub Actions / aarch64-linux: with shared openssl-4.0.1 / build

--- stdout --- Test failure: 'sql error messages are descriptive' Location: test/parallel/test-sqlite-template-tag.js:298:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such column/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:302:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Test failure: 'cached statements are finalized when the database is closed' Location: test/parallel/test-sqlite-template-tag.js:375:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such table/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:386:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Command: out/Release/node --expose-gc --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js

Check failure on line 302 in test/parallel/test-sqlite-template-tag.js

View workflow job for this annotation

GitHub Actions / aarch64-linux: with shared boringssl-0.20260803.0 / build

--- stdout --- Test failure: 'sql error messages are descriptive' Location: test/parallel/test-sqlite-template-tag.js:298:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such column/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:302:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Test failure: 'cached statements are finalized when the database is closed' Location: test/parallel/test-sqlite-template-tag.js:375:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such table/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:386:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Command: out/Release/node --expose-gc --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js

Check failure on line 302 in test/parallel/test-sqlite-template-tag.js

View workflow job for this annotation

GitHub Actions / aarch64-linux: with shared openssl-3.5.7 / build

--- stdout --- Test failure: 'sql error messages are descriptive' Location: test/parallel/test-sqlite-template-tag.js:298:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such column/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:302:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Test failure: 'cached statements are finalized when the database is closed' Location: test/parallel/test-sqlite-template-tag.js:375:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such table/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:386:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Command: out/Release/node --expose-gc --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js

Check failure on line 302 in test/parallel/test-sqlite-template-tag.js

View workflow job for this annotation

GitHub Actions / aarch64-linux: with shared openssl-3.0.21 / build

--- stdout --- Test failure: 'sql error messages are descriptive' Location: test/parallel/test-sqlite-template-tag.js:298:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such column/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:302:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Test failure: 'cached statements are finalized when the database is closed' Location: test/parallel/test-sqlite-template-tag.js:375:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such table/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:386:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Command: out/Release/node --expose-gc --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js

Check failure on line 302 in test/parallel/test-sqlite-template-tag.js

View workflow job for this annotation

GitHub Actions / aarch64-linux: with shared openssl-3.6.3 / build

--- stdout --- Test failure: 'sql error messages are descriptive' Location: test/parallel/test-sqlite-template-tag.js:298:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such column/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:302:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Test failure: 'cached statements are finalized when the database is closed' Location: test/parallel/test-sqlite-template-tag.js:375:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such table/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:386:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Command: out/Release/node --expose-gc --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js

Check failure on line 302 in test/parallel/test-sqlite-template-tag.js

View workflow job for this annotation

GitHub Actions / aarch64-linux: with shared openssl-fips-3.5.7 / build

--- stdout --- Test failure: 'sql error messages are descriptive' Location: test/parallel/test-sqlite-template-tag.js:298:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such column/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:302:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Test failure: 'cached statements are finalized when the database is closed' Location: test/parallel/test-sqlite-template-tag.js:375:1 AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { code: 'ERR_SQLITE_ERROR', + message: 'Failed to prepare statement' - message: /no such table/i } at TestContext.<anonymous> (/home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js:386:10) at Test.runInAsyncScope (node:async_hooks:227:14) at Test.run (node:internal/test_runner/test:1401:25) at async Test.processPendingSubtests (node:internal/test_runner/test:973:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [Error], expected: [Object], operator: 'throws', diff: 'simple' } Command: out/Release/node --expose-gc --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /home/runner/work/_temp/node-v27.0.0-nightly2026-08-1936fd2c57a1-slim/test/parallel/test-sqlite-template-tag.js
const result = sql.get`SELECT nonexistent_column FROM foo`;
assert.fail(`Expected error, got: ${JSON.stringify(result)}`);
}, {
Expand Down Expand Up @@ -388,3 +388,16 @@
message: /no such table/i,
});
});

test('failed prepares throw', () => {
assert.throws(() => {
sql.all`SELECT * FROM does_not_exist`;
}, {
name: 'Error',
message: 'Failed to prepare statement',
code: 'ERR_SQLITE_ERROR',
errcode: 1,
errstr: 'SQL logic error',
errmsg: 'no such table: does_not_exist'
});
});
Loading