summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/fs/interface.rs2
-rw-r--r--ext/io/fs.rs9
2 files changed, 10 insertions, 1 deletions
diff --git a/ext/fs/interface.rs b/ext/fs/interface.rs
index 2d9b68f55..7624535c9 100644
--- a/ext/fs/interface.rs
+++ b/ext/fs/interface.rs
@@ -100,7 +100,7 @@ pub trait FileSystem: std::fmt::Debug + MaybeSend + MaybeSync {
async fn mkdir_async(
&self,
path: PathBuf,
- recusive: bool,
+ recursive: bool,
mode: u32,
) -> FsResult<()>;
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 {