Skip to content

Commit e3e61f6

Browse files
committed
fix: fs.access error handling
1 parent 7ec91bf commit e3e61f6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/server.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ class CoCreateLazyLoader {
2222
async init() {
2323
const scriptsDirectory = './scripts';
2424

25-
if (!await fs.access(scriptsDirectory)) {
25+
try {
26+
await fs.access(directory);
27+
console.log("The directory exists.");
28+
} catch (error) {
2629
try {
2730
await fs.mkdir(scriptsDirectory, { recursive: true });
2831
console.log(`Scripts directory created at ${scriptsDirectory}`);

0 commit comments

Comments
 (0)