"when.promise" async await
/* Promise */somePromiseFunction() .catch(error => handlerErrorFunction(error)) .then(() => doSomethingFunction());/* async/await */try { await somePromiseFunction();} catch (error) { handleErrorFunction(error);} finally { doSomethingFunction();}/* Promise */const promiseFunction = () => { ... return somePromiseFunction();}/* async/await */const asyncFunction = async () => { ... return await somePromiseFunction();}/* Promise */somePromiseFunction() .then(result => { if (isMeaningful(result)) { return anotherPromiseFunction(); } else { return; }) .then(result => { if (result) { doSomething(); } else { doSomethingAnother(); });/* async/await */const result = await somePromiseFunction();if (isMeaningful(result)) { const anotherResult = await anotherPromiseFunction(); if (anotherResult) { doSomething(); }} else { doSomethingAnother();}