summaryrefslogtreecommitdiff
path: root/runtime/ops
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2024-10-18 12:30:46 -0700
committerGitHub <noreply@github.com>2024-10-18 19:30:46 +0000
commitd047cab14b754d20a43c7119e327b451440aaed9 (patch)
treebc0c4567f549349c2a1ca75748a69d83bc8f6c5c /runtime/ops
parent4b99cde504854baabdcf912f2fce3a7448119653 (diff)
refactor(ext/websocket): use concrete error type (#26226)
Diffstat (limited to 'runtime/ops')
-rw-r--r--runtime/ops/web_worker/sync_fetch.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/runtime/ops/web_worker/sync_fetch.rs b/runtime/ops/web_worker/sync_fetch.rs
index 87fc55840..bd55a5fc8 100644
--- a/runtime/ops/web_worker/sync_fetch.rs
+++ b/runtime/ops/web_worker/sync_fetch.rs
@@ -4,6 +4,7 @@ use std::sync::Arc;
use crate::web_worker::WebWorkerInternalHandle;
use crate::web_worker::WebWorkerType;
+use deno_core::error::custom_error;
use deno_core::error::type_error;
use deno_core::error::AnyError;
use deno_core::futures::StreamExt;
@@ -12,7 +13,6 @@ use deno_core::url::Url;
use deno_core::OpState;
use deno_fetch::data_url::DataUrl;
use deno_web::BlobStore;
-use deno_websocket::DomExceptionNetworkError;
use http_body_util::BodyExt;
use hyper::body::Bytes;
use serde::Deserialize;
@@ -151,17 +151,16 @@ pub fn op_worker_sync_fetch(
match mime_type.as_deref() {
Some("application/javascript" | "text/javascript") => {}
Some(mime_type) => {
- return Err(
- DomExceptionNetworkError {
- msg: format!("Invalid MIME type {mime_type:?}."),
- }
- .into(),
- )
+ return Err(custom_error(
+ "DOMExceptionNetworkError",
+ format!("Invalid MIME type {mime_type:?}."),
+ ))
}
None => {
- return Err(
- DomExceptionNetworkError::new("Missing MIME type.").into(),
- )
+ return Err(custom_error(
+ "DOMExceptionNetworkError",
+ "Missing MIME type.",
+ ))
}
}
}