Skip to content

Commit 518bed8

Browse files
authored
fix: clarify EACCES errors (#343)
1 parent 9bee415 commit 518bed8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sources/folderUtils.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {UsageError} from 'clipanion';
12
import {existsSync, mkdirSync, renameSync} from 'fs';
23
import {homedir, tmpdir} from 'os';
34
import {join} from 'path';
@@ -52,6 +53,8 @@ export function getTemporaryFolder(target: string = tmpdir()) {
5253
} catch (error) {
5354
if ((error as NodeError).code === `EEXIST`) {
5455
continue;
56+
} else if ((error as NodeError).code === `EACCES`) {
57+
throw new UsageError(`Failed to create cache directory. Please ensure the user has write access to the target directory (${target}). If the user's home directory does not exist, create it first.`);
5558
} else {
5659
throw error;
5760
}

0 commit comments

Comments
 (0)