summaryrefslogtreecommitdiff
path: root/cli/node/errors.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-09-05 12:36:35 +0200
committerGitHub <noreply@github.com>2022-09-05 12:36:35 +0200
commit264ad49e18161a29cf8831dff2e4bcbcea59d086 (patch)
tree6208eee3ad7bfabcc1a9885043cd8ba08b0a7618 /cli/node/errors.rs
parent16dbf4adc390c9fb7656372b42811c1929e755dd (diff)
refactor: cleanup Node compatibility code (#15766)
- move errors related to Node compat from cli/node/errors.rs to "ext/node" crate - remove dependency on "node_resolver" crate - make some of structures private to the "cli/node" module
Diffstat (limited to 'cli/node/errors.rs')
-rw-r--r--cli/node/errors.rs50
1 files changed, 0 insertions, 50 deletions
diff --git a/cli/node/errors.rs b/cli/node/errors.rs
deleted file mode 100644
index f14e6e92e..000000000
--- a/cli/node/errors.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::generic_error;
-use deno_core::error::type_error;
-use deno_core::error::AnyError;
-use deno_core::url::Url;
-
-pub fn err_invalid_module_specifier(
- request: &str,
- reason: &str,
- maybe_base: Option<String>,
-) -> AnyError {
- let mut msg = format!(
- "[ERR_INVALID_MODULE_SPECIFIER] Invalid module \"{}\" {}",
- request, reason
- );
-
- if let Some(base) = maybe_base {
- msg = format!("{} imported from {}", msg, base);
- }
-
- type_error(msg)
-}
-
-pub fn err_module_not_found(path: &str, base: &str, typ: &str) -> AnyError {
- generic_error(format!(
- "[ERR_MODULE_NOT_FOUND] Cannot find {} \"{}\" imported from \"{}\"",
- typ, path, base
- ))
-}
-
-pub fn err_unsupported_dir_import(path: &str, base: &str) -> AnyError {
- generic_error(format!("[ERR_UNSUPPORTED_DIR_IMPORT] Directory import '{}' is not supported resolving ES modules imported from {}", path, base))
-}
-
-pub fn err_unsupported_esm_url_scheme(url: &Url) -> AnyError {
- let mut msg =
- "[ERR_UNSUPPORTED_ESM_URL_SCHEME] Only file and data URLS are supported by the default ESM loader"
- .to_string();
-
- if cfg!(window) && url.scheme().len() == 2 {
- msg = format!(
- "{}. On Windows, absolute path must be valid file:// URLs",
- msg
- );
- }
-
- msg = format!("{}. Received protocol '{}'", msg, url.scheme());
- generic_error(msg)
-}