summaryrefslogtreecommitdiff
path: root/runtime/ops/web_worker.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2021-10-01 10:30:55 +0100
committerGitHub <noreply@github.com>2021-10-01 11:30:55 +0200
commitb354eaa2475a16f66e99efc82bebf5bd620406e4 (patch)
treeaa8d15ba548032e44834bb736b1d32882bf60688 /runtime/ops/web_worker.rs
parentc0b6c0eea59f0bea0ab12b2949a7c37c1a774293 (diff)
fix(runtime/js/workers): throw errors instead of using an op (#12249)
Diffstat (limited to 'runtime/ops/web_worker.rs')
-rw-r--r--runtime/ops/web_worker.rs24
1 files changed, 0 insertions, 24 deletions
diff --git a/runtime/ops/web_worker.rs b/runtime/ops/web_worker.rs
index 8439e4384..14ebb8d6e 100644
--- a/runtime/ops/web_worker.rs
+++ b/runtime/ops/web_worker.rs
@@ -4,8 +4,6 @@ mod sync_fetch;
use crate::web_worker::WebWorkerInternalHandle;
use crate::web_worker::WebWorkerType;
-use crate::web_worker::WorkerControlEvent;
-use deno_core::error::generic_error;
use deno_core::error::AnyError;
use deno_core::op_async;
use deno_core::op_sync;
@@ -25,11 +23,6 @@ pub fn init() -> Extension {
("op_worker_recv_message", op_async(op_worker_recv_message)),
// Notify host that guest worker closes.
("op_worker_close", op_sync(op_worker_close)),
- // Notify host that guest worker has unhandled error.
- (
- "op_worker_unhandled_error",
- op_sync(op_worker_unhandled_error),
- ),
("op_worker_get_type", op_sync(op_worker_get_type)),
("op_worker_sync_fetch", op_sync(op_worker_sync_fetch)),
])
@@ -70,23 +63,6 @@ fn op_worker_close(state: &mut OpState, _: (), _: ()) -> Result<(), AnyError> {
Ok(())
}
-/// A worker that encounters an uncaught error will pass this error
-/// to its parent worker using this op. The parent worker will use
-/// this same op to pass the error to its own parent (in case
-/// `e.preventDefault()` was not called in `worker.onerror`). This
-/// is done until the error reaches the root/ main worker.
-fn op_worker_unhandled_error(
- state: &mut OpState,
- message: String,
- _: (),
-) -> Result<(), AnyError> {
- let sender = state.borrow::<WebWorkerInternalHandle>().clone();
- sender
- .post_event(WorkerControlEvent::Error(generic_error(message)))
- .expect("Failed to propagate error event to parent worker");
- Ok(())
-}
-
fn op_worker_get_type(
state: &mut OpState,
_: (),