Introducing my customized error handling function:
function onError(message, source, lineno, colno, error) { sendRequestToSendMail(arguments) }
window.onerror = onError
In addition to that, I have asynchronous tasks utilizing promises and I aim to capture exceptions within them without redundancy:
doSomething1()
.then(doSomething2(), onError)
.then(doSomething3(), onError)
.then(doSomething4(), onError)
Is there a way to create a universal error handler for all promises (similar to window.onError)?