mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 15:00:01 -04:00
properly strip stack frames containing scramjet handlers
This commit is contained in:
parent
1dba0f8fa0
commit
29d6dadecb
1 changed files with 12 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue