How can I reject a promise that returned by an async/await function?
e.g. Originally:
This is not an answer over @T.J. Crowder's one. Just an comment responding to the comment "And actually, if the exception is going to be converted to a rejection, I'm not sure whether I am actually bothered if it's an Error. My reasons for throwing only Error probably don't apply."
if your code is using async/await, then it is still a good practice to reject with an Error instead of 400:
try {
await foo('a');
}
catch (e) {
// you would still want `e` to be an `Error` instead of `400`
}