await-parse-error

0.1.0 • Public • Published

await-parse-error

Simple module to bind await-to-js with parse-error modules as described in this article.

Pre-requisites

The pre-requisites from await-to-js:

You need to use Node 7.6 (or later) or an ES7 transpiler in order to use async/await functionality. You can use babel or typescript for that.

Install

npm i -s await-parse-error

Usage

Use it just like in await-to-js but now the error will be a parse error object as described in parse-error

const tope = require('await-parse-error'); // use whatever name you like... I like to as in the original but it may be confusing if I use it at the same time

[ err, user ] = await tope(UserModel.findById(1));
if(!user) return cb('No user found');

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i await-parse-error

    Weekly Downloads

    1

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    3.03 kB

    Total Files

    4

    Last publish

    Collaborators

    • s1moe2