{"name":"err-code","version":"3.0.1","description":"Create an error with a code","main":"index.js","types":"dist/index.d.ts","scripts":{"lint":"eslint '{./*.js,test/**/*.js}'","check":"tsc --noEmit","prepare":"tsc --emitDeclarationOnly --declarationDir dist","test":"mocha --bail","prepublishOnly":"browserify -s err-code index.js > index.umd.js"},"bugs":{"url":"https://github.com/IndigoUnited/js-err-code/issues/"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/js-err-code.git"},"keywords":["error","err","code","properties","property"],"author":{"name":"IndigoUnited","email":"hello@indigounited.com","url":"http://indigounited.com"},"license":"MIT","devDependencies":{"@satazor/eslint-config":"^3.0.0","@types/expect.js":"0.3.29","@types/mocha":"8.2.0","browserify":"^17.0.0","eslint":"^7.19.0","expect.js":"^0.3.1","mocha":"^8.2.1","typescript":"^4.1.3"},"gitHead":"830d141eb633c21b842df3f78aba5786fee1b31d","homepage":"https://github.com/IndigoUnited/js-err-code#readme","_id":"err-code@3.0.1","_nodeVersion":"14.15.4","_npmVersion":"6.14.10","dist":{"integrity":"sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==","shasum":"a444c7b992705f2b120ee320b09972eef331c920","tarball":"http://registry-npm.ywwl.com/err-code/download/err-code-3.0.1.tgz","fileCount":5,"unpackedSize":7757,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgHWpXCRA9TVsSAnZWagAAfdEP/2JmsJpZgDEqJQtvM5rr\njRLk8VefHig7/k6Z001Jwq837KelxngSxjkJARwFijZs36mthYzHLG2eabrE\nBsOutv5pQNf9HcnvQi6rx6q4N3A2iCs8y7p85kE02jLKfKsr8GA6WFu1rfRY\nOn9lrpzkJMr2pkgp7Xa2dbWqIvPvzGfqd3E0UP37bbld+XiwStbOvBrrzOgO\np/ezTioZ7kP9mgCD/GYgiQz3ymzUmUZ9l0kfnOIeJHKA6DZnC7VJe6sqYJ9A\niDnIHTeZsGW2RanhZl5lzxyEp7ecE0hNsgU++msxb1HFgfcq12zwFgGHFlcw\nC0ofvz+4di4HCBNLAcHA0SvPy8WMPA+kQh5Ozn1/Af2rLHCUd+ucq0Pe8fl2\nEYzqafn/h+2x6858NqMpN/O+VXkrodRr3+cYxerfHJXd0mTjcw968c2YF76A\nGfDn4t4VWVTAPR/PXJt2uwD4QPRd+7qnoVv6XtvDm+UoT8EoDI7x2gefhqSz\noLbezMMmTgHyJ+r7oUDuqZlpyhhWv7iWcerRE1hxzAgi9Ej7RLqanzSO1Rrl\ni2HHnd7jTWP8br+WIX1iKoK6HNdD47L/aSpVC+4uF8rKLEZ6SvxFB10o/UsB\nQIJ9PprAj56jN83GmQg5vVhV8qLa9deuUvPOfDpX8JZryem2cQOSZHsQhfEA\nL0xz\r\n=nWV0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG2K3cAgmQvXTnH2SGcG+pb9fp9e0+rxvLvM6oMhD3GNAiEAtx4BhwmEAfhDgYPbKp7nVyCBg/LdKOTYr7JzaOuzWOY="}],"size":2596,"noattachment":false,"key":"/err-code/-/err-code-3.0.1.tgz"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"satazor","email":"andremiguelcruz@msn.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/err-code_3.0.1_1612540503177_0.25365575138573626"},"_hasShrinkwrap":false,"readme":"# err-code\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] [![Greenkeeper badge][greenkeeper-image]][greenkeeper-url]\n\n[npm-url]:https://npmjs.org/package/err-code\n[downloads-image]:http://img.shields.io/npm/dm/err-code.svg\n[npm-image]:http://img.shields.io/npm/v/err-code.svg\n[travis-url]:https://travis-ci.org/IndigoUnited/js-err-code\n[travis-image]:http://img.shields.io/travis/IndigoUnited/js-err-code/master.svg\n[david-dm-url]:https://david-dm.org/IndigoUnited/js-err-code\n[david-dm-image]:https://img.shields.io/david/IndigoUnited/js-err-code.svg\n[david-dm-dev-url]:https://david-dm.org/IndigoUnited/js-err-code?type=dev\n[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/js-err-code.svg\n[greenkeeper-image]:https://badges.greenkeeper.io/IndigoUnited/js-err-code.svg\n[greenkeeper-url]:https://greenkeeper.io/\n\nCreate new error instances with a code and additional properties.\n\n\n## Installation\n\n```console\n$ npm install err-code\n// or\n$ bower install err-code\n```\n\nThe browser file is named index.umd.js which supports CommonJS, AMD and globals (errCode).\n\n\n## Why\n\nI find myself doing this repeatedly:\n\n```js\nvar err = new Error('My message');\nerr.code = 'SOMECODE';\nerr.detail = 'Additional information about the error';\nthrow err;\n```\n\n\n## Usage\n\nSimple usage.\n\n```js\nvar errcode = require('err-code');\n\n// fill error with message + code\nthrow errcode(new Error('My message'), 'ESOMECODE');\n// fill error with message + code + props\nthrow errcode(new Error('My message'), 'ESOMECODE', { detail: 'Additional information about the error' });\n// fill error with message + props\nthrow errcode(new Error('My message'), { detail: 'Additional information about the error' });\n```\n\n## Pre-existing fields\n\nIf the passed `Error` already has a `.code` field, or fields specified in the third argument to `errcode` they will be overwritten, unless the fields are read only or otherwise throw during assignment in which case a new object will be created that shares a prototype chain with the original `Error`. The `.stack` and `.message` properties will be carried over from the original error and `.code` or any passed properties will be set on it.\n\n\n## Tests\n\n`$ npm test`\n\n\n## License\n\nReleased under the [MIT License](http://www.opensource.org/licenses/mit-license.php).\n","publish_time":1612540503335,"_cnpm_publish_time":1612540503335,"dist-tags":{"latest":"3.0.1"}}