diff options
Diffstat (limited to 'ext/io/fs.rs')
-rw-r--r-- | ext/io/fs.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/io/fs.rs b/ext/io/fs.rs index a333e1dd5..e335324f5 100644 --- a/ext/io/fs.rs +++ b/ext/io/fs.rs @@ -15,6 +15,7 @@ use deno_core::OpState; use deno_core::ResourceId; use tokio::task::JoinError; +#[derive(Debug)] pub enum FsError { Io(io::Error), FileBusy, @@ -29,6 +30,14 @@ impl FsError { Self::NotSupported => io::ErrorKind::Other, } } + + pub fn into_io_error(self) -> io::Error { + match self { + FsError::Io(err) => err, + FsError::FileBusy => io::Error::new(self.kind(), "file busy"), + FsError::NotSupported => io::Error::new(self.kind(), "not supported"), + } + } } impl From<io::Error> for FsError { |