Skip to content

Solve the try-catch hell using golang style error handling.

Notifications You must be signed in to change notification settings

klipitkas/await-to

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

await-to

Solve the try-catch hell using golang style error handling.

Install

npm i @klipitkas/await-to --save

Usage

import { to } from 'await-to';

const doSomething = () => {
  const [ data, error ] = await to(resolveOrRejectSomePromise());

  if (error) {
    throw new Error("Whoops!");
  }

  return data;
}

Test

npm run test

About

Solve the try-catch hell using golang style error handling.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published