mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix(ext/web): Preserve stack traces for DOMExceptions (#11959)
This commit is contained in:
parent
b31dad89a6
commit
d947629292
2 changed files with 13 additions and 0 deletions
|
@ -1,2 +1,3 @@
|
|||
[WILDCARD]error: Uncaught SyntaxError: foo
|
||||
[WILDCARD]
|
||||
at file:///[WILDCARD]/dom_exception_formatting.ts:[WILDCARD]
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
((window) => {
|
||||
const {
|
||||
ArrayPrototypeSlice,
|
||||
Error,
|
||||
ErrorPrototype,
|
||||
ObjectDefineProperty,
|
||||
ObjectEntries,
|
||||
|
@ -94,6 +96,16 @@
|
|||
context: "Argument 2",
|
||||
});
|
||||
this.#code = nameToCodeMapping[this.#name] ?? 0;
|
||||
|
||||
// `DOMException` does not have `.stack`, so `Error.prepareStackTrace()`
|
||||
// is not called on it, meaning our structured stack trace hack doesn't
|
||||
// apply. This patches it in.
|
||||
const error = new Error();
|
||||
error.stack;
|
||||
ObjectDefineProperty(this, "__callSiteEvals", {
|
||||
value: ArrayPrototypeSlice(error.__callSiteEvals, 1),
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
|
||||
get message() {
|
||||
|
|
Loading…
Add table
Reference in a new issue