summaryrefslogtreecommitdiff
path: root/cli/module_loader.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-12-15 16:52:55 +1100
committerGitHub <noreply@github.com>2020-12-15 16:52:55 +1100
commit63a821b78b5a293c0eb5b3ecc18d67bde8331eda (patch)
tree4229af0ba8b9f56467f1355b0c53054b69039edf /cli/module_loader.rs
parentb6d5ae1ecd125ce8a14cddc877cb66dbcfc9bb04 (diff)
fix(cli): make dynamic import errors catchable (#8750)
Fixes #6259
Diffstat (limited to 'cli/module_loader.rs')
-rw-r--r--cli/module_loader.rs18
1 files changed, 3 insertions, 15 deletions
diff --git a/cli/module_loader.rs b/cli/module_loader.rs
index da75b8510..aab951c4a 100644
--- a/cli/module_loader.rs
+++ b/cli/module_loader.rs
@@ -94,26 +94,14 @@ impl ModuleLoader for CliModuleLoader {
maybe_referrer: Option<ModuleSpecifier>,
_is_dynamic: bool,
) -> Pin<Box<deno_core::ModuleSourceFuture>> {
- let module_specifier = module_specifier.to_owned();
- let module_url_specified = module_specifier.to_string();
+ let module_specifier = module_specifier.clone();
let program_state = self.program_state.clone();
// NOTE: this block is async only because of `deno_core`
// interface requirements; module was already loaded
// when constructing module graph during call to `prepare_load`.
- let fut = async move {
- let compiled_module = program_state
- .fetch_compiled_module(module_specifier, maybe_referrer)?;
- Ok(deno_core::ModuleSource {
- // Real module name, might be different from initial specifier
- // due to redirections.
- code: compiled_module.code,
- module_url_specified,
- module_url_found: compiled_module.name,
- })
- };
-
- fut.boxed_local()
+ async move { program_state.load(module_specifier, maybe_referrer) }
+ .boxed_local()
}
fn prepare_load(