Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 1.21 KB

README.md

File metadata and controls

40 lines (28 loc) · 1.21 KB

@scipe/create-error

styled with prettier

CircleCI

Note: this module is auto published to npm on CircleCI. Only run npm version patch|minor|major and let CI do the rest.

Create an error with a code property

import createError from '@scipe/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 '@scipe/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
});

License

@scipe/create-error is dual-licensed under commercial and open source licenses (AGPLv3) based on the intended use case. Contact us to learn which license applies to your use case.