diff options
author | Luca Casonato <hello@lcas.dev> | 2024-09-10 20:12:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-10 11:12:24 -0700 |
commit | 7bfcb4dd10d31f5f9566c90a28449c0951f3a48e (patch) | |
tree | fca0dec6e98118418f1712c6e8451a04c7e89988 /ext/io | |
parent | be5419d479fcae16c8a07dec00ce11b532b7996a (diff) |
feat(cli): use NotCapable error for permission errors (#25431)
Closes #7394
---------
Co-authored-by: snek <snek@deno.com>
Diffstat (limited to 'ext/io')
-rw-r--r-- | ext/io/fs.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/io/fs.rs b/ext/io/fs.rs index 88e4eee47..3798c1429 100644 --- a/ext/io/fs.rs +++ b/ext/io/fs.rs @@ -22,7 +22,7 @@ pub enum FsError { Io(io::Error), FileBusy, NotSupported, - PermissionDenied(&'static str), + NotCapable(&'static str), } impl FsError { @@ -31,7 +31,7 @@ impl FsError { Self::Io(err) => err.kind(), Self::FileBusy => io::ErrorKind::Other, Self::NotSupported => io::ErrorKind::Other, - Self::PermissionDenied(_) => io::ErrorKind::PermissionDenied, + Self::NotCapable(_) => io::ErrorKind::Other, } } @@ -40,7 +40,7 @@ impl FsError { FsError::Io(err) => err, FsError::FileBusy => io::Error::new(self.kind(), "file busy"), FsError::NotSupported => io::Error::new(self.kind(), "not supported"), - FsError::PermissionDenied(err) => { + FsError::NotCapable(err) => { io::Error::new(self.kind(), format!("requires {err} access")) } } @@ -65,8 +65,8 @@ impl From<FsError> for AnyError { FsError::Io(err) => AnyError::from(err), FsError::FileBusy => resource_unavailable(), FsError::NotSupported => not_supported(), - FsError::PermissionDenied(err) => { - custom_error("PermissionDenied", format!("permission denied: {err}")) + FsError::NotCapable(err) => { + custom_error("NotCapable", format!("permission denied: {err}")) } } } |