summaryrefslogtreecommitdiff
path: root/cli/msg_util.rs
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2019-07-11 00:53:48 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-07-11 14:37:00 -0400
commitabe8a113ad8004f160eac5f3f115cb28c5072ba7 (patch)
tree099b2b019bd7b5d1689cfa5b4bef3ceded10c59d /cli/msg_util.rs
parentdb5c66a638d399d5ebb2832bb7b52e8f76ced49d (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/msg_util.rs')
-rw-r--r--cli/msg_util.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/cli/msg_util.rs b/cli/msg_util.rs
index 0ecb7f0d6..e37a91f3a 100644
--- a/cli/msg_util.rs
+++ b/cli/msg_util.rs
@@ -1,9 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
// Helpers for serialization.
-use crate::deno_error;
-use crate::deno_error::DenoResult;
use crate::msg;
-
+use deno::ErrBox;
use flatbuffers;
use http::header::HeaderName;
use http::uri::Uri;
@@ -97,14 +95,13 @@ pub fn serialize_http_response<'bldr>(
pub fn deserialize_request(
header_msg: msg::HttpHeader<'_>,
body: Body,
-) -> DenoResult<Request<Body>> {
+) -> Result<Request<Body>, ErrBox> {
let mut r = Request::new(body);
assert!(header_msg.is_request());
let u = header_msg.url().unwrap();
- let u = Uri::from_str(u)
- .map_err(|e| deno_error::new(msg::ErrorKind::InvalidUri, e.to_string()))?;
+ let u = Uri::from_str(u).map_err(ErrBox::from)?;
*r.uri_mut() = u;
if let Some(method) = header_msg.method() {