mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
8b31fc23cd
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.
24 lines
560 B
JavaScript
24 lines
560 B
JavaScript
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
|
"use strict";
|
|
|
|
((window) => {
|
|
const core = window.Deno.core;
|
|
|
|
function opFormatDiagnostics(diagnostics) {
|
|
return core.opSync("op_format_diagnostic", diagnostics);
|
|
}
|
|
|
|
function opFormatFileName(location) {
|
|
return core.opSync("op_format_file_name", location);
|
|
}
|
|
|
|
function opApplySourceMap(location) {
|
|
return core.applySourceMap(location);
|
|
}
|
|
|
|
window.__bootstrap.errorStack = {
|
|
opFormatDiagnostics,
|
|
opFormatFileName,
|
|
opApplySourceMap,
|
|
};
|
|
})(this);
|