JavaScript tentang pengecualian tanpa batas
// NODE JS
process.on('uncaughtException', function (error) {
// Handle the error
});
// Browser
window.onunhandledrejection = event => {
console.warn(`UNHANDLED PROMISE REJECTION: ${event.reason}`);
};
window.onerror = function(message, source, lineNumber, colno, error) {
console.warn(`UNHANDLED ERROR: ${error.stack}`);
};
// OR
window.addEventListener('error', function(event) { ... })
Beautiful Beaver