@fireproof/core 0.10.2-dev → 0.10.4-dev

Sign up to get free protection for your applications and to get access to all the features.
@@ -17385,11 +17385,13 @@ You can use close({ resize: true }) to resize header`);
17385
17385
  }
17386
17386
  load(cid) {
17387
17387
  return __async(this, null, function* () {
17388
+ console.log("loading", cid.toString());
17388
17389
  return yield this.withDB((db) => __async(this, null, function* () {
17389
17390
  const tx = db.transaction(["cars"], "readonly");
17390
17391
  const bytes = yield tx.objectStore("cars").get(cid.toString());
17391
17392
  if (!bytes)
17392
- throw new Error(`missing block ${cid.toString()}`);
17393
+ throw new Error(`missing idb block ${cid.toString()}`);
17394
+ console.log("loaded", cid.toString());
17393
17395
  return { cid, bytes };
17394
17396
  }));
17395
17397
  });
@@ -17416,15 +17418,21 @@ You can use close({ resize: true }) to resize header`);
17416
17418
  // eslint-disable-next-line @typescript-eslint/require-await
17417
17419
  load(branch = "main") {
17418
17420
  return __async(this, null, function* () {
17419
- const bytes = localStorage.getItem(this.headerKey(branch));
17420
- return bytes ? this.parseHeader(bytes.toString()) : null;
17421
+ try {
17422
+ const bytes = localStorage.getItem(this.headerKey(branch));
17423
+ return bytes ? this.parseHeader(bytes.toString()) : null;
17424
+ } catch (e5) {
17425
+ }
17421
17426
  });
17422
17427
  }
17423
17428
  // eslint-disable-next-line @typescript-eslint/require-await
17424
17429
  save(carCid, branch = "main") {
17425
17430
  return __async(this, null, function* () {
17426
- const headerKey = this.headerKey(branch);
17427
- return localStorage.setItem(headerKey, this.makeHeader(carCid));
17431
+ try {
17432
+ const headerKey = this.headerKey(branch);
17433
+ return localStorage.setItem(headerKey, this.makeHeader(carCid));
17434
+ } catch (e5) {
17435
+ }
17428
17436
  });
17429
17437
  }
17430
17438
  };