@scienceai/create-error

3.1.1 • Public • Published

create-error

CircleCI

styled with prettier

Create an error with a code property

import createError from '@scienceai/create-error';

createError();
createError(404);
createError('not found');
createError(404, 'not found');

Automatically handle CouchDB and API responses (from request or XHR)

import createError from '@scienceai/create-error';
import request from 'request';

request('http://example.com/couchdb', (err, resp, body) => {
  if (err = createError(err, resp, body)) {
    return callback(err);
  }

  // no error, we can process body
});

Readme

Keywords

Package Sidebar

Install

npm i @scienceai/create-error

Weekly Downloads

1

Version

3.1.1

License

AGPL-3.0-or-later

Unpacked Size

44.6 kB

Total Files

7

Last publish

Collaborators

  • scienceai