forked from denoland/deno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli/fmt_errors): don't panic on source line formatting errors (de…
…noland#12449) Returns empty values in case of errors, source lines are non-essential anyway. These errors can happen e.g. when source files change at runtime. A warning is also printed to help us track when it happens in unexpected cases besides this.
- Loading branch information
Showing
6 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
throw new Error("foo"); |
6 changes: 6 additions & 0 deletions
6
cli/tests/testdata/eval_context_throw_with_conflicting_source.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// deno-lint-ignore no-explicit-any | ||
const [, errorInfo] = (Deno as any).core.evalContext( | ||
'/* aaaaaaaaaaaaaaaaa */ throw new Error("foo")', | ||
new URL("eval_context_conflicting_source.ts", import.meta.url).href, | ||
); | ||
throw errorInfo.thrown; |
4 changes: 4 additions & 0 deletions
4
cli/tests/testdata/eval_context_throw_with_conflicting_source.ts.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[WILDCARD]error: Uncaught Error: foo | ||
Warning Couldn't format source line: Column 31 is out of bounds (source may have changed at runtime) | ||
at file:https:///[WILDCARD]/eval_context_conflicting_source.ts:1:31 | ||
at file:https:///[WILDCARD]/eval_context_throw_with_conflicting_source.ts:[WILDCARD] |