Skip to content

Create an instance of Error with a code property mostly from various CouchDB responses

Notifications You must be signed in to change notification settings

science-periodicals/create-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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.

About

Create an instance of Error with a code property mostly from various CouchDB responses

Resources

Stars

Watchers

Forks

Packages

No packages published