npm

@wh1zk1d/nice-try
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

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
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @wh1zk1d/nice-try

Weekly Downloads

7

Version

0.0.5

License

MIT

Unpacked Size

4.09 kB

Total Files

6

Last publish

Collaborators

  • wh1zk1d