await-error-handle
TypeScript icon, indicating that this package has built-in type declarations

1.0.12 • Public • Published

await-error-handle

Codecov Coverage GitHub

Purpose

await-error-handle is a package designed to simplify handling errors that come back when you await an async function.

Installation

Add to your project using npm i -S await-error-handle

Usage

import errorHandle from 'await-error-handle';

const [err, res] = await errorHandle(Promise.resolve('yay'));

// err = null
// res = 'yay'
import errorHandle from 'await-error-handle';

const [err, res] = await errorHandle(Promise.reject(new Error('boo')));

// err = [Error boo]
// res = undefined

/await-error-handle/

    Package Sidebar

    Install

    npm i await-error-handle

    Weekly Downloads

    0

    Version

    1.0.12

    License

    MIT

    Unpacked Size

    12.7 kB

    Total Files

    21

    Last publish

    Collaborators

    • nickheal