Skip to content

Commit

Permalink
fix: fs.access error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Dec 30, 2023
1 parent 7ec91bf commit e3e61f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ class CoCreateLazyLoader {
async init() {
const scriptsDirectory = './scripts';

if (!await fs.access(scriptsDirectory)) {
try {
await fs.access(directory);
console.log("The directory exists.");
} catch (error) {
try {
await fs.mkdir(scriptsDirectory, { recursive: true });
console.log(`Scripts directory created at ${scriptsDirectory}`);
Expand Down

0 comments on commit e3e61f6

Please sign in to comment.