mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Blow up if the error isn't EEXIST
This commit is contained in:
@@ -22,7 +22,7 @@ export async function loadSettings() {
|
|||||||
try {
|
try {
|
||||||
await mkdirAsync(paths.pathTo('settings'));
|
await mkdirAsync(paths.pathTo('settings'));
|
||||||
} catch (e2) {
|
} catch (e2) {
|
||||||
if (e2.code !== 'EEXIST') console.error('Failed to create settings directory: ' + e2);
|
if (e2.code !== 'EEXIST') throw e;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error('Error reading settings file: ' + e);
|
console.error('Error reading settings file: ' + e);
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ export class StatsTracker {
|
|||||||
try {
|
try {
|
||||||
fs.mkdirSync(path.dirname(this.statsPath), { recursive: true });
|
fs.mkdirSync(path.dirname(this.statsPath), { recursive: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.code !== 'EEXIST') console.error('Failed to create stats directory: ' + e);
|
if (e.code !== 'EEXIST') throw e;
|
||||||
}
|
}
|
||||||
fs.writeFileSync(this.statsPath, encodeCSV(statsHeaders), { encoding: 'utf8' });
|
fs.writeFileSync(this.statsPath, encodeCSV(statsHeaders), { encoding: 'utf8' });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user