JSFiddle - React, Tailwind, and code Playground
by kouty79
JavaScript
window.onerror = function(msg, url, line, col, error) {
console.log('onerror', ...arguments);
};
window.addEventListener("unhandledrejection", function(...args) {
console.log('unhandledrejection', 'pippo',...args);
});
setTimeout(()=>{throw 'aaa';}, 100);
new Promise((_,reject)=>{
setTimeout(()=>reject('bbb'), 200);
});
for(let methodName in console) {
if(typeof console[methodName] === "function" ) {
const method = console[methodName].bind(console);
console[methodName] = function(...args) {
method('aaa ' + methodName, args);
}
}
}