一些微小的贡献

This commit is contained in:
KirinBaka
2025-04-22 15:19:28 +08:00
parent a04f1c22c9
commit bebf2c9640
7 changed files with 26 additions and 13 deletions

View File

@@ -30,7 +30,13 @@ class Store {
await this.save();
}
public async save() {
await write(this.filename, JSON.stringify(this.record), "utf8");
// try first, then catch
try {
console.log("store::index: save record", this.record);
await write(this.filename, JSON.stringify(this.record), "utf8");
} catch {
console.error("store::index: save record error, filename:", this.filename);
}
}
}
@@ -52,7 +58,12 @@ class HTML {
public async set(html: string) {
this.html = html;
// store into file
await write(this.filename, html, "utf8");
// try first, then catch
try {
await write(this.filename, html, "utf8");
} catch {
console.error("store::index: save record error, filename:", this.filename);
}
}
}