{"_id":"define-error","_rev":"4-c4412dd70510ff15f011b3ce3ddb64fd","name":"define-error","description":"Define errors without frills, but with stack traces and instanceof support.","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"define-error","version":"1.0.0","description":"Define errors without frills, but with stack traces and instanceof support.","main":"index.js","repository":{"type":"git","url":"git://github.com/jasonpincin/define-error.git"},"keywords":["create","error","stack","stacktrace","instanceof"],"license":"MIT","bugs":{"url":"https://github.com/jasonpincin/define-error/issues"},"homepage":"https://github.com/jasonpincin/define-error","author":{"name":"Jason Pincin","email":"jason@pincin.com","url":"http://jason.pincin.com/"},"contributors":[],"devDependencies":{"@jasonpincin/standard":"~5.0.0-7","istanbul":"~0.3.17","opn":"~1.0.2","phantomjs":"~1.9.18","tap-dot":"~1.0.0","tap-spec":"~4.0.2","tape":"~4.1.0","zuul":"~3.2.0"},"dependencies":{"capture-stack-trace":"~1.0.0"},"scripts":{"test":"make npm-test","coverage":"make npm-coverage","browser-tests":"zuul -- test/*.js"},"gitHead":"182140a8a3ba86c004b91f022f460547c17bddb0","_id":"define-error@1.0.0","_shasum":"5fb48a45dd5f65f88f82b0c9a223c0193379d3fe","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"jasonpincin","email":"jason@pincin.com"},"maintainers":[{"name":"jasonpincin","email":"jason@pincin.com"}],"dist":{"shasum":"5fb48a45dd5f65f88f82b0c9a223c0193379d3fe","tarball":"https://registry.npmjs.org/define-error/-/define-error-1.0.0.tgz","integrity":"sha512-HLdUb9mNENZ/tjnZGlITfOnx7wSM7a6e+WEDyhKSrsN/g5dJUS6kepG6qJApRLAdjRofQ2W8R3yrtI6GeyGGVg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHBPVqY+tqfgDhotWmu2lNWMjiO+jycoUePqrL+uEV3qAiA1GOF3Zror28CnJBNLbpGVXPpfpuupxB7n/XcwE0s86A=="}]}},"1.1.0":{"name":"define-error","version":"1.1.0","description":"Define errors without frills, but with stack traces and instanceof support.","main":"index.js","repository":{"type":"git","url":"git://github.com/jasonpincin/define-error.git"},"keywords":["create","error","stack","stacktrace","instanceof"],"license":"MIT","bugs":{"url":"https://github.com/jasonpincin/define-error/issues"},"homepage":"https://github.com/jasonpincin/define-error","author":{"name":"Jason Pincin","email":"jason@pincin.com","url":"http://jason.pincin.com/"},"contributors":[],"devDependencies":{"@jasonpincin/standard":"~5.0.0-8","faucet":"0.0.1","istanbul":"~0.4.0","opn":"~1.0.2","phantomjs":"~1.9.18","snazzy":"~2.0.1","tape":"~4.2.2","zuul":"~3.6.0"},"dependencies":{},"scripts":{"test":"npm run -s faucet && npm run -s lint && npm run -s check-cover","travis-test":"npm run -s tap && ((cat coverage/lcov.info | coveralls) || exit 0)","travis-browser-test":"zuul -- test/*.js","faucet":"istanbul cover --report lcov --print none -- tape test/*.js | faucet","tap":"istanbul cover --report lcov --print none -- tape test/*.js","phantom":"zuul --phantom -- test/*.js | faucet","lint":"standard | snazzy","check-cover":"istanbul check-coverage --statements 100 --branches 100 --functions 100 --lines 100 2>&1 | grep ERROR: ; (test ${PIPESTATUS[0]} -eq 0) || (istanbul report text; exit 1)","view-cover":"istanbul report text","open-cover":"open coverage/index.html"},"gitHead":"bd3bb1190d8e956786433898bc0cb0dc4bd82eee","_id":"define-error@1.1.0","_shasum":"795bd74c5421c99e808dda41ea7010bb11df51e2","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"jasonpincin","email":"jason@pincin.com"},"maintainers":[{"name":"jasonpincin","email":"jason@pincin.com"}],"dist":{"shasum":"795bd74c5421c99e808dda41ea7010bb11df51e2","tarball":"https://registry.npmjs.org/define-error/-/define-error-1.1.0.tgz","integrity":"sha512-Ehf7OMP3G4nKPbS578vWMilq6IjHhH6YaBsE7fRraJCBEw/Wum8C/a2QZPO+QtOXWjLz90KnHxLkD2QeQcxCrQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID3PdRcXrmpqiAv5yGVTHE91AAFVspqUNxF4RiTUBtXdAiEAiI8Zz2QeCaNgU4NLpJ4Flg2V7wYUs3VlkfMmuIOpFXE="}]}}},"readme":"# define-error\n\n[![NPM version](https://badge.fury.io/js/define-error.png)](http://badge.fury.io/js/define-error)\n[![Build Status](https://travis-ci.org/jasonpincin/define-error.svg?branch=master)](https://travis-ci.org/jasonpincin/define-error)\n[![Coverage Status](https://coveralls.io/repos/jasonpincin/define-error/badge.png?branch=master)](https://coveralls.io/r/jasonpincin/define-error?branch=master)\n[![Sauce Test Status](https://saucelabs.com/browser-matrix/jp-define-error.svg)](https://saucelabs.com/u/jp-define-error)\n\nDefine errors without frills, but with stack traces and instanceof support. \n\n## example\n\nFirst, create and expose a singleton that defines your errors such as `errors.js`:\n\n```javascript\nvar defineError = require('define-error')\n\nmodule.exports.DatabaseError = defineError('DatabaseError')\n\nmodule.exports.HttpResponseError = defineError('HttpResponseError', function (message, code) {\n    this.code = code\n})\n```\n\nThen use them:\n\n```javascript\nvar assert            = require('assert'),\n    DatabaseError     = require('./errors').DatabaseError,\n    HttpResponseError = require('./errors').HttpResponseError\n\nfunction query () {\n    throw new DatabaseError('No database to query silly')\n}\n\nfunction request () {\n    throw new HttpResponseError('Nobody out there', 404)\n}\n\ntry {\n    query()\n}\ncatch (err) {\n    assert(err instanceof DatabaseError)\n    assert(err instanceof Error)\n    console.error(err)\n}\n\ntry {\n    request()\n}\ncatch (err) {\n    assert(err instanceof HttpResponseError)\n    assert(!(err instanceof DatabaseError))\n    assert(err instanceof Error)\n    assert(err.code)\n    console.error(err)\n}\n```\n\n## api\n\n```javascript\nvar defineError = require('define-error')\n```\n\n### var CustomError = defineError('CustomError' [, initFunc])\n\nCreate an error constructor, `CustomError(message)`. `Error` will be in the prototype chain. If an `initFunc` function is provided, it will be called in the context of the error being created with all arguments that were passed to the error constructor. This will happen after the `message` and `stack` properties are set on the error object.\n\n## install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install --save define-error\n```\n\n## testing\n\n`npm test`\n\nOr to run tests in phantom: `npm run phantom`\n\n### coverage\n\n`npm run view-cover`\n\nThis will output a textual coverage report.\n\n`npm run open-cover`\n\nThis will open an HTML coverage report in the default browser.\n","maintainers":[{"name":"jasonpincin","email":"jason@pincin.com"}],"time":{"modified":"2022-06-14T23:27:05.433Z","created":"2015-08-13T15:34:07.609Z","1.0.0":"2015-08-13T15:34:07.609Z","1.1.0":"2015-10-26T03:54:57.641Z"},"homepage":"https://github.com/jasonpincin/define-error","keywords":["create","error","stack","stacktrace","instanceof"],"repository":{"type":"git","url":"git://github.com/jasonpincin/define-error.git"},"contributors":[],"author":{"name":"Jason Pincin","email":"jason@pincin.com","url":"http://jason.pincin.com/"},"bugs":{"url":"https://github.com/jasonpincin/define-error/issues"},"license":"MIT","readmeFilename":"README.md"}