mirror of
https://github.com/jcreek/OpenNetworkDiagram.git
synced 2026-07-12 18:43:44 +00:00
fix(#5): clean up temp file when network data rename fails
This commit is contained in:
@@ -134,7 +134,12 @@ export async function writeNetworkFile(data) {
|
|||||||
} finally {
|
} finally {
|
||||||
await fileHandle.close();
|
await fileHandle.close();
|
||||||
}
|
}
|
||||||
await rename(temporaryPath, source);
|
try {
|
||||||
|
await rename(temporaryPath, source);
|
||||||
|
} catch (renameError) {
|
||||||
|
await unlink(temporaryPath).catch(() => undefined);
|
||||||
|
throw renameError;
|
||||||
|
}
|
||||||
|
|
||||||
await trimBackups(backupDirectory, path.basename(source), 5);
|
await trimBackups(backupDirectory, path.basename(source), 5);
|
||||||
const updatedAt = await readUpdatedAt(source);
|
const updatedAt = await readUpdatedAt(source);
|
||||||
|
|||||||
Reference in New Issue
Block a user