diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-09-22 23:05:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-23 00:05:42 +0200 |
commit | ef3e4a8f74ea65cfed58c1276696f50a8779f816 (patch) | |
tree | 9c7dd09f51087d525c0354962b215fc33febb57e /cli/main.rs | |
parent | 0cb00a6e89d83d4e16e6616f7af8819bd894b0da (diff) |
feat: Show hints when using `window` global (#25805)
This commit adds better handling for terminal errors when
`window` global is used. This global is removed in Deno 2,
and while we have lints to help with that, an information and
hints are helpful to guide users to working code.
Ref https://github.com/denoland/deno/issues/25797
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cli/main.rs b/cli/main.rs index a7e1c8342..84c3704ca 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -380,6 +380,11 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec<FixSuggestion> { "Run again with `--unstable-broadcast-channel` flag to enable this API.", ), ]; + } else if msg.contains("window is not defined") { + return vec![ + FixSuggestion::info("window global is not available in Deno 2."), + FixSuggestion::hint("Replace `window` with `globalThis`."), + ]; } } |