一些微小的贡献
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user