catch promise rejections

This commit is contained in:
velzie 2024-08-09 17:09:02 -04:00
parent 696c9b3092
commit df55dc9fc6
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F

View file

@ -97,4 +97,15 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
argdbg(t);
return t;
};
client.Proxy("Promise.prototype.catch", {
apply(ctx) {
ctx.args[0] = new Proxy(ctx.args[0], {
apply(target, thisArg, argArray) {
console.warn("CAUGHT PROMISE REJECTION", argArray);
Reflect.apply(target, thisArg, argArray);
},
});
},
});
}