diff options
author | Bert Belder <bertbelder@gmail.com> | 2019-07-11 00:53:48 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-07-11 14:37:00 -0400 |
commit | abe8a113ad8004f160eac5f3f115cb28c5072ba7 (patch) | |
tree | 099b2b019bd7b5d1689cfa5b4bef3ceded10c59d /cli/dispatch_minimal.rs | |
parent | db5c66a638d399d5ebb2832bb7b52e8f76ced49d (diff) |
Refactor error to use dynamic dispatch and traits
This is in preperation for dynamic import (#1789), which is more easily
implemented when errors are dynamic.
Diffstat (limited to 'cli/dispatch_minimal.rs')
-rw-r--r-- | cli/dispatch_minimal.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cli/dispatch_minimal.rs b/cli/dispatch_minimal.rs index bda9ea535..9d82595d1 100644 --- a/cli/dispatch_minimal.rs +++ b/cli/dispatch_minimal.rs @@ -127,10 +127,11 @@ mod ops { use crate::deno_error; use crate::resources; use crate::tokio_write; + use deno::ErrBox; use deno::PinnedBuf; use futures::Future; - type MinimalOp = dyn Future<Item = i32, Error = deno_error::DenoError> + Send; + type MinimalOp = dyn Future<Item = i32, Error = ErrBox> + Send; pub fn read(rid: i32, zero_copy: Option<PinnedBuf>) -> Box<MinimalOp> { debug!("read rid={}", rid); @@ -144,7 +145,7 @@ mod ops { None => Box::new(futures::future::err(deno_error::bad_resource())), Some(resource) => Box::new( tokio::io::read(resource, zero_copy) - .map_err(deno_error::DenoError::from) + .map_err(ErrBox::from) .and_then(move |(_resource, _buf, nread)| Ok(nread as i32)), ), } @@ -162,7 +163,7 @@ mod ops { None => Box::new(futures::future::err(deno_error::bad_resource())), Some(resource) => Box::new( tokio_write::write(resource, zero_copy) - .map_err(deno_error::DenoError::from) + .map_err(ErrBox::from) .and_then(move |(_resource, _buf, nwritten)| Ok(nwritten as i32)), ), } |