【发布时间】:2016-09-26 23:04:09
【问题描述】:
以下代码可以正常工作:
pool.getConnection()
.then((conn)=>{
// something here
})
.catch((err) => {
throw err;
});
但是,当我重新格式化它时,节点会抛出错误:
return pool.getConnection()
.then((conn) => {
//something here
})
.then(results => results[0].insertId)
.catch(err => throw err); <-- NODE COMPALINS HERE
$>somefile.js line(190)
.catch(err => throw err);
^^^^^
SyntaxError: Unexpected token throw
我在这里错过了什么?
【问题讨论】:
标签: javascript