Skip to content

🤙 A small wrapper around try/catch, to make error handling in promises a bit more comfy.

Notifications You must be signed in to change notification settings

jannbar/nice-try

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nice-try

A small wrapper around try/catch, to make error handling in promises a bit more comfy.

Installation

pnpm

pnpm add @wh1zk1d/nice-try

yarn

yarn add @wh1zk1d/nice-try

npm

npm install @wh1zk1d/nice-try

Usage

async function fetchData() {
  const [data, error] = await niceTry(fetch('http://jsonplaceholder.typicode.com/todos'))
  
  if (error) {
    // Handle error
  }
}

About

🤙 A small wrapper around try/catch, to make error handling in promises a bit more comfy.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published