@ai-ecoverse/slicc-kernel 1.65.1 → 1.65.2

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/dist/node.js CHANGED
@@ -2998,15 +2998,15 @@ function translate(err, path, op = "lookup", mapped = true) {
2998
2998
  if (typeof err?.code === "string") return err;
2999
2999
  const raw = err?.name;
3000
3000
  const name2 = typeof raw === "string" ? raw : "Error";
3001
- const code = mapped && ERRNO_BY_DOM_ERROR[name2] || "EIO";
3001
+ const code = name2 === "QuotaExceededError" ? "ENOSPC" : mapped && ERRNO_BY_DOM_ERROR[name2] || "EIO";
3002
3002
  const error = Object.assign(fsError(code, path), { domName: name2, op, cause: err });
3003
- if (code !== "EIO") return error;
3003
+ if (code !== "EIO" && code !== "ENOSPC") return error;
3004
3004
  const detail = err?.message;
3005
3005
  error.message += ` (OPFS ${op}: ${name2}${typeof detail === "string" && detail ? `: ${detail}` : ""})`;
3006
3006
  if (!reported.has(`${name2}/${op}`)) {
3007
3007
  reported.add(`${name2}/${op}`);
3008
3008
  console.warn(
3009
- `slicc-kernel: ${error.message}, reported as EIO; logged once per error and operation`
3009
+ `slicc-kernel: ${error.message}, reported as ${code}; logged once per error and operation`
3010
3010
  );
3011
3011
  }
3012
3012
  return error;
@@ -3512,11 +3512,13 @@ var OpfsFs = class {
3512
3512
  const [file, existed, target] = await this.fileFor(path);
3513
3513
  if (!existed) await this.stampNew(target, owner, false);
3514
3514
  if (!existed && content.length === 0) return;
3515
+ let writable2;
3515
3516
  try {
3516
- const writable2 = await file.createWritable();
3517
+ writable2 = await file.createWritable();
3517
3518
  await writable2.write(content);
3518
3519
  await writable2.close();
3519
3520
  } catch (err) {
3521
+ await writable2?.abort().catch(() => void 0);
3520
3522
  throw translate(err, path, "commit", false);
3521
3523
  }
3522
3524
  }