summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2021-09-18 14:40:04 +0100
committerGitHub <noreply@github.com>2021-09-18 15:40:04 +0200
commit75ca013f076f443dce3d38f31a168295351ed0e5 (patch)
treea8f369429ff650516a513a0416e8984f457835a4 /runtime/js
parentf840906943849f5a09981e172d57e84301b77386 (diff)
fix(cli/fmt_errors): Abbreviate long data URLs in stack traces (#12127)
Co-authored-by: Mike White <mike.white@auctane.com>
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/40_error_stack.js7
-rw-r--r--runtime/js/99_main.js18
2 files changed, 13 insertions, 12 deletions
diff --git a/runtime/js/40_error_stack.js b/runtime/js/40_error_stack.js
index e73975044..c8f2aff5a 100644
--- a/runtime/js/40_error_stack.js
+++ b/runtime/js/40_error_stack.js
@@ -8,6 +8,10 @@
return core.opSync("op_format_diagnostic", diagnostics);
}
+ function opFormatFileName(location) {
+ return core.opSync("op_format_file_name", location);
+ }
+
function opApplySourceMap(location) {
const res = core.opSync("op_apply_source_map", location);
return {
@@ -18,7 +22,8 @@
}
window.__bootstrap.errorStack = {
- opApplySourceMap,
opFormatDiagnostics,
+ opFormatFileName,
+ opApplySourceMap,
};
})(this);
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index 5c1c04766..b16fabe8a 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -218,17 +218,13 @@ delete Object.prototype.__proto__;
);
build.setBuildInfo(runtimeOptions.target);
util.setLogDebug(runtimeOptions.debugFlag, source);
- // TODO(bartlomieju): a very crude way to disable
- // source mapping of errors. This condition is true
- // only for compiled standalone binaries.
- let prepareStackTrace;
- if (runtimeOptions.applySourceMaps) {
- prepareStackTrace = core.createPrepareStackTrace(
- errorStack.opApplySourceMap,
- );
- } else {
- prepareStackTrace = core.createPrepareStackTrace();
- }
+ const prepareStackTrace = core.createPrepareStackTrace(
+ // TODO(bartlomieju): a very crude way to disable
+ // source mapping of errors. This condition is true
+ // only for compiled standalone binaries.
+ runtimeOptions.applySourceMaps ? errorStack.opApplySourceMap : undefined,
+ errorStack.opFormatFileName,
+ );
// deno-lint-ignore prefer-primordials
Error.prepareStackTrace = prepareStackTrace;
}