Why do native Promises act like a try/catch when it comes to syntax errors?
Promises clearly have value in flow control when you need to perform a number of async operations in order. But the necessity of having to implement your own inadequate error handing implementations for every promise sometimes makes them a hassle to work with.
Take the following code:
asdf
let one = new Promise((resolve, reject) => {
asdf
}).catch(err => {
console.log(err)
console.log(err.stack)
})
The first syntax error produces a typical browser error and a stack trace with 18 entries. The promise'd version has 4.
So my question is why, when writing the spec and implementing it natively, did they retain the try/catch like functionality of the userspace implementation of promises so that it could be used for flow control but leave the standard error handling?