diff --git a/src/client/shared/error.ts b/src/client/shared/error.ts new file mode 100644 index 0000000..5446915 --- /dev/null +++ b/src/client/shared/error.ts @@ -0,0 +1,18 @@ +import { decodeUrl } from "../../shared"; +import { ScramjetClient } from "../client"; + +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) => { + let newstack = error.stack; + + for (let i = 0; i < stack.length; i++) { + const url = stack[i].getFileName(); + try { + newstack = newstack.replaceAll(url, decodeUrl(url)); + } catch {} + } + + return newstack; + }; +}