diff --git a/src/client/shared/error.ts b/src/client/shared/error.ts index 5051760..9494272 100644 --- a/src/client/shared/error.ts +++ b/src/client/shared/error.ts @@ -1,4 +1,4 @@ -import { decodeUrl } from "../../shared"; +import { config, decodeUrl } from "../../shared"; import { ScramjetClient } from "../client"; export const enabled = () => self.$scramjet.config.flags.cleanerrors; @@ -9,9 +9,19 @@ export default function (client: ScramjetClient, self: Self) { for (let i = 0; i < stack.length; i++) { const url = stack[i].getFileName(); + + if (url.endsWith(config.client)) { + // strip stack frames including scramjet handlers from the trace + let lines = newstack.split("\n"); + let i = lines.find((l) => l.includes(url)); + lines.splice(i, 1); + newstack = lines.join("\n"); + continue; + } + try { newstack = newstack.replaceAll(url, decodeUrl(url)); - } catch { } + } catch {} } return newstack;