We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
isSystemError
createTemporaryFile
1 parent 4ed7be8 commit 5ce4300Copy full SHA for 5ce4300
workspaces/util/src/createTemporaryFile.ts
@@ -2,6 +2,7 @@ import { constants } from "node:fs";
2
import { open as openFile, type FileHandle } from "node:fs/promises";
3
4
import { getRandomBytes } from "@code-chronicles/util/getRandomBytes";
5
+import { isSystemError } from "@code-chronicles/util/isSystemError";
6
7
export async function createTemporaryFile(
8
prefix: string = "",
@@ -29,7 +30,7 @@ export async function createTemporaryFile(
29
30
try {
31
// We won the lottery and came up with a temporary file name that
32
// already exists. Try again?
- if ((e as { code: string }).code === "EEXIST") {
33
+ if (isSystemError(e) && e.code === "EEXIST") {
34
continue;
35
}
36
} catch {}
0 commit comments