botbotbot 's blog

Async Await

Async/Await is the part of ES7 that currently draft version new standard of javascript. It is pattern for solving Callback Hell problem that nowaday is solve by ES6 Promises. Async/Await is wrapper of Promises pattern that make you can program in synchronous style without blocking the thread. To use ES7 for your project today, you need to use Babel to compile your ES7 to ES5 that can run in client side with browser and server side with nodeJS




let err = {};

try {
  await someFn();
} catch (e) {
  err = e;

expect(err.message).to.equal("some error message");