From 8b31fc23cd80de9baa62535e95367da7a21c9cfd Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Fri, 15 Apr 2022 15:08:09 +0100 Subject: refactor: Move source map lookups to core (#14274) The following transformations gradually faced by "JsError" have all been moved up front to "JsError::from_v8_exception()": - finding the first non-"deno:" source line; - moving "JsError::script_resource_name" etc. into the first error stack in case of syntax errors; - source mapping "JsError::script_resource_name" etc. when wrapping the error even though the frame locations are source mapped earlier; - removing "JsError::{script_resource_name,line_number,start_column,end_column}" entirely in favour of "js_error.frames.get(0)". We also no longer pass a js-side callback to "core/02_error.js" from cli. I avoided doing this on previous occasions because the source map lookups were in an awkward place. --- cli/tests/testdata/future_check1.out | 2 +- cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out | 2 -- cli/tests/testdata/test/aggregate_error.out | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) (limited to 'cli/tests/testdata') diff --git a/cli/tests/testdata/future_check1.out b/cli/tests/testdata/future_check1.out index 9c7592fc5..7505efcd4 100644 --- a/cli/tests/testdata/future_check1.out +++ b/cli/tests/testdata/future_check1.out @@ -1,3 +1,3 @@ -Warning In future releases `deno run` will not automatically type check without the --check flag. +Warning In future releases `deno run` will not automatically type check without the --check flag. To opt into this new behavior now, specify DENO_FUTURE_CHECK=1. Check [WILDCARD]/future_check.ts diff --git a/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out b/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out index 9280361f7..4f9127da6 100644 --- a/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out +++ b/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out @@ -1,4 +1,2 @@ error: Uncaught Error: Hello world! -throw new Error("Hello world!" as unknown as string); - ^ at http://localhost:4545/inline_js_source_map_2.ts:6:7 diff --git a/cli/tests/testdata/test/aggregate_error.out b/cli/tests/testdata/test/aggregate_error.out index 1fbdcb350..35349e67c 100644 --- a/cli/tests/testdata/test/aggregate_error.out +++ b/cli/tests/testdata/test/aggregate_error.out @@ -1,4 +1,3 @@ -Check [WILDCARD]/testdata/test/aggregate_error.ts running 1 test from test/aggregate_error.ts aggregate ... FAILED ([WILDCARD]) -- cgit v1.2.3