mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 23:10:02 -04:00
fix error preparestacktrace can get overwritten
This commit is contained in:
parent
592e8d183f
commit
c412959a5f
1 changed files with 11 additions and 2 deletions
|
@ -4,7 +4,7 @@ import { ScramjetClient } from "../client";
|
|||
export const enabled = () => self.$scramjet.config.flags.cleanerrors;
|
||||
export default function (client: ScramjetClient, self: Self) {
|
||||
// v8 only. all we need to do is clean the scramjet urls from stack traces
|
||||
Error.prepareStackTrace = (error, stack) => {
|
||||
const closure = (error, stack) => {
|
||||
let newstack = error.stack;
|
||||
|
||||
for (let i = 0; i < stack.length; i++) {
|
||||
|
@ -16,4 +16,13 @@ export default function (client: ScramjetClient, self: Self) {
|
|||
|
||||
return newstack;
|
||||
};
|
||||
client.Trap("Error.prepareStackTrace", {
|
||||
get(ctx) {
|
||||
// this is a funny js quirk. the getter is ran every time you type something in console
|
||||
return closure;
|
||||
},
|
||||
set(value) {
|
||||
// just ignore it if a site tries setting their own. not much we can really do
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue