-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Corepack "EACCES": Clearer Errors #343
Conversation
sources/folderUtils.ts
Outdated
@@ -52,6 +53,8 @@ export function getTemporaryFolder(target: string = tmpdir()) { | |||
} catch (error) { | |||
if ((error as NodeError).code === `EEXIST`) { | |||
continue; | |||
} else if ((error as NodeError).code === `EACCES`) { | |||
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.`, {cause: error}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arcanis it would maybe make sense to add support for this in Clipanion, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.`, {cause: error}); | |
// @ts-expect-error UsageError expects one argument | |
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.`, {cause: error}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now should we remove the cause: error
?
There are still lint errors to address. |
#329
Targeted Error Handling: Code distinguishes between EEXIST (not relevant) and EACCES (triggers the specific error message), while other errors are still thrown for debugging.
Implementation: Changes are made in the getTemporaryFolder function within node_modules/corepack/dist/lib/corepack.cjs.
Testing: not done.