Skip to content

Safely use async await without all the try/catch blocks

Notifications You must be signed in to change notification settings

DavidWells/safe-await

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Safe Await

Safely use async/await without all the try catch blocks

Usage

const safeAwait = require('safe-await')

async function fooBar() {
  const [error, data] = await safeAwait(promiseOne())

  if (error) {
    // handle error, retry, ignore, whatever
  }

  console.log(data)
}

See usage and tests for more examples.

Research

Other libraries

Other handy error utils

About

Safely use async await without all the try/catch blocks

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published