标签:try catch div error set console row pre promise erro
Promise里的同步部分不需要try catch
new Promise((resolve, reject) => { throw new Error(‘error‘); setTimeout(() => { }, 100); }).catch(e => { console.log(‘log‘, e); });;
异步部分需要try catch
new Promise((resolve, reject) => { setTimeout(() => { try{ throw new Error(‘error‘); } catch(e) { reject(e); } }, 100); }).catch(e => { console.log(‘log‘, e); });;
标签:try catch div error set console row pre promise erro
原文地址:https://www.cnblogs.com/chen8840/p/9920636.html