Skip to content

Instantly share code, notes, and snippets.

@peterli888
Last active August 12, 2018 16:12
Show Gist options
  • Save peterli888/a11a2e7e592bae04ef1e47499a291a40 to your computer and use it in GitHub Desktop.
Save peterli888/a11a2e7e592bae04ef1e47499a291a40 to your computer and use it in GitHub Desktop.
function awaitall(promise) {
//这个能捕捉错误
return promise.then(data => {
return [null, data];
})
.catch(err => [err]);
}
let [err,res]=await awaitall(aysncfn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment