In node v8 the code in test.js will result in the following:
(node:47866) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Thrown error
(node:47866) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: Thrown error
at foo (/Users/benjiegillam/Documents/test/test.js:2:9)
at Object.<anonymous> (/Users/benjiegillam/Documents/test/test.js:5:17)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)