Skip to content

Commit d3160c1

Browse files
author
Oscar Franco
committed
Also change asyncExecute to take a fail function with a status check to keep api consistent
1 parent e8b4f42 commit d3160c1

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ interface IDBConnection {
312312
asyncExecuteSql: (
313313
query: string,
314314
params: any[] | undefined,
315-
cb: (res: QueryResult) => void
315+
cb: (res: QueryResult) => void,
316+
fail: (msg: string) => void
316317
) => void;
317318
executeSqlBatch: (
318319
commands: SQLBatchParams[],
@@ -372,10 +373,14 @@ export const openDatabase = (
372373
asyncExecuteSql: (
373374
sql: string,
374375
params: any[] | undefined,
375-
cb: (res: QueryResult) => void
376+
cb: (res: QueryResult) => void,
377+
fail: (msg: string) => void
376378
) => {
377379
try {
378380
sqlite.asyncExecuteSql(options.name, sql, params, (response) => {
381+
if (response.status === 1) {
382+
fail(response.message);
383+
}
379384
enhanceQueryResult(response);
380385
cb(response);
381386
});

0 commit comments

Comments
 (0)