await-error-handle

    1.0.9 • 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

    Install

    npm i await-error-handle

    DownloadsWeekly Downloads

    18

    Version

    1.0.9

    License

    MIT

    Unpacked Size

    5.61 kB

    Total Files

    14

    Last publish

    Collaborators

    • avatar