summaryrefslogtreecommitdiff
path: root/ext/fetch
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fetch')
-rw-r--r--ext/fetch/lib.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs
index e89df470a..eb2fed683 100644
--- a/ext/fetch/lib.rs
+++ b/ext/fetch/lib.rs
@@ -1,7 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use data_url::DataUrl;
-use deno_core::error::bad_resource_id;
use deno_core::error::null_opbuf;
use deno_core::error::type_error;
use deno_core::error::AnyError;
@@ -163,10 +162,7 @@ where
FP: FetchPermissions + 'static,
{
let client = if let Some(rid) = args.client_rid {
- let r = state
- .resource_table
- .get::<HttpClientResource>(rid)
- .ok_or_else(bad_resource_id)?;
+ let r = state.resource_table.get::<HttpClientResource>(rid)?;
r.client.clone()
} else {
let client = state.borrow::<reqwest::Client>();
@@ -345,8 +341,7 @@ pub async fn op_fetch_send(
let request = state
.borrow_mut()
.resource_table
- .take::<FetchRequestResource>(rid)
- .ok_or_else(bad_resource_id)?;
+ .take::<FetchRequestResource>(rid)?;
let request = Rc::try_unwrap(request)
.ok()
@@ -402,8 +397,7 @@ pub async fn op_fetch_request_write(
let resource = state
.borrow()
.resource_table
- .get::<FetchRequestBodyResource>(rid)
- .ok_or_else(bad_resource_id)?;
+ .get::<FetchRequestBodyResource>(rid)?;
let body = RcRef::map(&resource, |r| &r.body).borrow_mut().await;
let cancel = RcRef::map(resource, |r| &r.cancel);
body.send(Ok(buf)).or_cancel(cancel).await?.map_err(|_| {
@@ -423,8 +417,7 @@ pub async fn op_fetch_response_read(
let resource = state
.borrow()
.resource_table
- .get::<FetchResponseBodyResource>(rid)
- .ok_or_else(bad_resource_id)?;
+ .get::<FetchResponseBodyResource>(rid)?;
let mut reader = RcRef::map(&resource, |r| &r.reader).borrow_mut().await;
let cancel = RcRef::map(resource, |r| &r.cancel);
let mut buf = data.clone();