Here is an example of my code:
try { //Тут другой код который может вызвать ошибку setTimeout(()=>{ throw new Error('Тестовая ошибка!'); },1); } catch (e) { alert('Ошибка: '+e.name + ":" + e.message); } How to catch the error caused in the setTimeout handler?