@livestore/wa-sqlite 1.0.1-dev.19 → 1.0.1-dev.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/wa-sqlite",
3
- "version": "1.0.1-dev.19",
3
+ "version": "1.0.1-dev.20",
4
4
  "type": "module",
5
5
  "main": "src/sqlite-api.js",
6
6
  "types": "src/types/index.d.ts",
package/src/sqlite-api.js CHANGED
@@ -289,7 +289,8 @@ export function Factory(Module) {
289
289
  verifyDatabase(source);
290
290
  const backup = fInit(dest, destName, source, sourceName);
291
291
  if (backup === 0) {
292
- throw new SQLiteError('backup failed', SQLite.SQLITE_ERROR);
292
+ const errMsg = Module.ccall('sqlite3_errmsg', 'string', ['number'], [dest]);
293
+ throw new SQLiteError(`backup failed: ${errMsg}`, SQLite.SQLITE_ERROR);
293
294
  }
294
295
  fStep(backup, -1);
295
296
  return fFinish(backup);
@@ -389,6 +389,8 @@ interface SQLiteAPI {
389
389
 
390
390
  /**
391
391
  * Combines the `backup_init`, `backup_step`, and `backup_finish` functions.
392
+ * destName/sourceName is usually "main" or "temp".
393
+ *
392
394
  * @returns `SQLITE_OK` (throws exception on error)
393
395
  */
394
396
  backup(pDest: number, zDestName: string, pSource: number, zSourceName: string): number;