Skip to content
Merged
Prev Previous commit
Next Next commit
sqlite: fix error code key and add test
  • Loading branch information
louwers committed Dec 28, 2024
commit df86bb171438777b6be171adaa9ea4e5a83fe82c
2 changes: 1 addition & 1 deletion src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ inline MaybeLocal<Object> CreateSQLiteError(Isolate* isolate,
->ToObject(isolate->GetCurrentContext())
.ToLocal(&e) ||
e->Set(isolate->GetCurrentContext(),
env->error_string(),
env->code_string(),
env->err_sqlite_error_string())
.IsNothing()) {
return MaybeLocal<Object>();
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-sqlite-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ suite('conflict resolution', () => {
() => -1,
() => ({}),
() => null,
async () => constants.SQLITE_CHANGESET_ABORT
async () => constants.SQLITE_CHANGESET_ABORT,
];

for (const invalidHandler of invalidHandlers) {
Expand All @@ -340,7 +340,8 @@ suite('conflict resolution', () => {
}, {
name: 'Error',
message: 'bad parameter or other API misuse',
errcode: 21
errcode: 21,
code: 'ERR_SQLITE_ERROR'
}, `Did not throw expected exception when returning '${invalidHandler}' from conflict handler`);
}
});
Expand Down