News for hackers. Stuff that matters.
Re:Async and Await by peterjuras on Thursday June 02, 2016 @12:38PM (#11823923)
You can use the await keyword multiple times, and therefore make it easier to handle the error with try catch:

      async someNetworkCall() {
        let unlock = await this.m.lock();

        try {
          const result = await doSomethingAsynchronous();
          // handle result
        } catch (exception) {
          // handle error
        }
        unlock();
      }

There are no comments on this comment yet.