Skip to content

Instantly share code, notes, and snippets.

@shana
Created July 24, 2018 14:15
Show Gist options
  • Save shana/46b64998f8e3b91f3622cbf4c1479592 to your computer and use it in GitHub Desktop.
Save shana/46b64998f8e3b91f3622cbf4c1479592 to your computer and use it in GitHub Desktop.
await promise without try/catch
const [data, err] = await new Promise((resolve, reject) =>
doSomething(resolve, reject)
)
.then(data => [data, undefined])
.catch(e => [undefined, e]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment