summaryrefslogtreecommitdiff
path: root/runtime/fmt_errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/fmt_errors.rs')
-rw-r--r--runtime/fmt_errors.rs20
1 files changed, 16 insertions, 4 deletions
diff --git a/runtime/fmt_errors.rs b/runtime/fmt_errors.rs
index 28cd70296..6c05fbc63 100644
--- a/runtime/fmt_errors.rs
+++ b/runtime/fmt_errors.rs
@@ -339,28 +339,40 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec<FixSuggestion> {
FixSuggestion::info(cstr!(
"<u>Buffer</> is not available in the global scope in Deno."
)),
- FixSuggestion::hint(cstr!("Import it explicitly with <u>import { Buffer } from \"node:buffer\";</>.")),
+ FixSuggestion::hint_multiline(&[
+ cstr!("Import it explicitly with <u>import { Buffer } from \"node:buffer\";</>,"),
+ cstr!("or run again with <u>--unstable-node-globals</> flag to add this global."),
+ ]),
];
} else if msg.contains("clearImmediate is not defined") {
return vec![
FixSuggestion::info(cstr!(
"<u>clearImmediate</> is not available in the global scope in Deno."
)),
- FixSuggestion::hint(cstr!("Import it explicitly with <u>import { clearImmediate } from \"node:timers\";</>.")),
+ FixSuggestion::hint_multiline(&[
+ cstr!("Import it explicitly with <u>import { clearImmediate } from \"node:timers\";</>,"),
+ cstr!("or run again with <u>--unstable-node-globals</> flag to add this global."),
+ ]),
];
} else if msg.contains("setImmediate is not defined") {
return vec![
FixSuggestion::info(cstr!(
"<u>setImmediate</> is not available in the global scope in Deno."
)),
- FixSuggestion::hint(cstr!("Import it explicitly with <u>import { setImmediate } from \"node:timers\";</>.")),
+ FixSuggestion::hint_multiline(
+ &[cstr!("Import it explicitly with <u>import { setImmediate } from \"node:timers\";</>,"),
+ cstr!("or run again with <u>--unstable-node-globals</> flag to add this global."),
+ ]),
];
} else if msg.contains("global is not defined") {
return vec![
FixSuggestion::info(cstr!(
"<u>global</> is not available in the global scope in Deno."
)),
- FixSuggestion::hint(cstr!("Use <u>globalThis</> instead, or assign <u>globalThis.global = globalThis</>.")),
+ FixSuggestion::hint_multiline(&[
+ cstr!("Use <u>globalThis</> instead, or assign <u>globalThis.global = globalThis</>,"),
+ cstr!("or run again with <u>--unstable-node-globals</> flag to add this global."),
+ ]),
];
} else if msg.contains("openKv is not a function") {
return vec![