diff options
Diffstat (limited to 'runtime/fmt_errors.rs')
-rw-r--r-- | runtime/fmt_errors.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/fmt_errors.rs b/runtime/fmt_errors.rs index 0d4274e8a..2d9d09a29 100644 --- a/runtime/fmt_errors.rs +++ b/runtime/fmt_errors.rs @@ -1,5 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. //! This mod provides DenoError to unify errors across Deno. +use color_print::cstr; use deno_core::error::format_frame; use deno_core::error::JsError; use deno_terminal::colors::cyan; @@ -367,6 +368,16 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec<FixSuggestion> { ] ) ]; + } else if msg.contains("document is not defined") { + return vec![ + FixSuggestion::info(cstr!( + "<u>document</> global is not available in Deno." + )), + FixSuggestion::hint_multiline(&[ + cstr!("Use a library like <u>happy-dom</>, <u>deno_dom</>, <u>linkedom</> or <u>JSDom</>"), + cstr!("and setup the <u>document</> global according to the library documentation."), + ]), + ]; } } |