summaryrefslogtreecommitdiff
path: root/runtime/web_worker.rs
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/web_worker.rs')
-rw-r--r--runtime/web_worker.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs
index 57c3909e1..cdc3d7e3d 100644
--- a/runtime/web_worker.rs
+++ b/runtime/web_worker.rs
@@ -8,6 +8,7 @@ use crate::ops;
use crate::permissions::Permissions;
use crate::tokio_util::create_basic_runtime;
use deno_core::error::AnyError;
+use deno_core::error::Context as ErrorContext;
use deno_core::futures::channel::mpsc;
use deno_core::futures::future::poll_fn;
use deno_core::futures::future::FutureExt;
@@ -320,7 +321,9 @@ impl WebWorker {
/// Same as execute2() but the filename defaults to "$CWD/__anonymous__".
pub fn execute(&mut self, js_source: &str) -> Result<(), AnyError> {
- let path = env::current_dir().unwrap().join("__anonymous__");
+ let path = env::current_dir()
+ .context("Failed to get current working directory")?
+ .join("__anonymous__");
let url = Url::from_file_path(path).unwrap();
self.js_runtime.execute(url.as_str(), js_source)
}