Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.2k
error.PermissionDenied vs error.AccessDenied #16782
Copy link
Copy link
Closed
Labels
proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This issue suggests language modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Metadata
Metadata
Assignees
Labels
proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This issue suggests language modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
These two error names are common through the Zig codebase, but they seem to be used pretty much interchangeably and don't seem to ever be used to convey unique information, so it seems like one canonical version should be chosen and used everywhere (or a distinction should be made about when to use one over another).
Some evidence for why I think it might make sense to merge them:
There is no explicit error set that I can find that includes bothPermissionDeniedandAccessDenied, meaning that there is (presumably) nothing that intentionally uses one name over another to convey unique information. Put another way, there wouldn't be any information that is currently conveyed that would be lost if they were merged.error.PermissionDeniedvserror.AccessDenied#16782 (comment)error.AccessDenied => return error.PermissionDenied(and more will be added by Windows: FixTooManyParentDirshandling for paths that shouldn't be cwd-relative #16783).ACCESS_DENIED => return error.PermissionDeniedand 7 instances of.ACCES => return error.PermissionDenied.PERM => return error.AccessDeniedIn terms of which is more common:
return error.PermissionDeniedreturn error.AccessDenied