{"_id":"human-error","_rev":"1738705","name":"human-error","description":"Errors that people can understand","dist-tags":{"latest":"0.3.0"},"maintainers":[{"name":"franciscop","email":"developerfrancisco@hotmail.com"}],"time":{"modified":"2021-11-29T01:33:11.000Z","created":"2017-01-27T21:40:36.818Z","0.3.0":"2017-07-24T21:06:14.143Z","0.2.0":"2017-01-28T01:28:08.781Z","0.1.0":"2017-01-27T21:40:36.818Z"},"users":{},"author":{"name":"Francisco Presencia","email":"public@francisco.io","url":"http://francisco.io/"},"repository":{"type":"git","url":"git+https://github.com/franciscop/human-error.git"},"versions":{"0.3.0":{"name":"human-error","version":"0.3.0","description":"Errors that people can understand","main":"human-error.js","scripts":{"test":"jest --coverage"},"repository":{"type":"git","url":"git+https://github.com/franciscop/human-error.git"},"keywords":["error","generate","pretty","print","show","mistake"],"author":{"name":"Francisco Presencia","email":"public@francisco.io","url":"http://francisco.io/"},"license":"MIT","bugs":{"url":"https://github.com/franciscop/human-error/issues"},"homepage":"https://github.com/franciscop/human-error#readme","devDependencies":{"jest":"^18.1.0"},"gitHead":"8784979a1bb14fa75c162884b90a4091d325ef45","_id":"human-error@0.3.0","_npmVersion":"5.0.0","_nodeVersion":"8.0.0","_npmUser":{"name":"franciscop","email":"public@francisco.io"},"dist":{"shasum":"b76cd8233bfbcd4373d780025640c29dbcee8621","size":354618,"noattachment":false,"key":"/human-error/-/human-error-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/human-error/download/human-error-0.3.0.tgz"},"maintainers":[{"name":"franciscop","email":"developerfrancisco@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/human-error-0.3.0.tgz_1500930372623_0.6363603048957884"},"directories":{},"publish_time":1500930374143,"_hasShrinkwrap":false,"_cnpm_publish_time":1500930374143},"0.2.0":{"name":"human-error","version":"0.2.0","description":"Errors that people can understand","main":"human-error.js","scripts":{"test":"jest --coverage"},"repository":{"type":"git","url":"git+https://github.com/franciscop/human-error.git"},"keywords":["error","generate","pretty","print","show","mistake"],"author":{"name":"Francisco Presencia","email":"public@francisco.io","url":"http://francisco.io/"},"license":"MIT","bugs":{"url":"https://github.com/franciscop/human-error/issues"},"homepage":"https://github.com/franciscop/human-error#readme","devDependencies":{"jest":"^18.1.0"},"gitHead":"2093dcee919380f1572cafbec3af0aef8749c844","_id":"human-error@0.2.0","_shasum":"c79bf5dfab3f0910558d05705b25217b92d0baec","_from":".","_npmVersion":"3.10.10","_nodeVersion":"7.2.1","_npmUser":{"name":"franciscop","email":"public@francisco.io"},"dist":{"shasum":"c79bf5dfab3f0910558d05705b25217b92d0baec","size":354474,"noattachment":false,"key":"/human-error/-/human-error-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/human-error/download/human-error-0.2.0.tgz"},"maintainers":[{"name":"franciscop","email":"developerfrancisco@hotmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/human-error-0.2.0.tgz_1485566888118_0.3220606576651335"},"directories":{},"publish_time":1485566888781,"_cnpm_publish_time":1485566888781,"_hasShrinkwrap":false},"0.1.0":{"name":"human-error","version":"0.1.0","description":"Errors that people can understand","main":"human-error.js","scripts":{"test":"jest"},"repository":{"type":"git","url":"git+https://github.com/franciscop/human-error.git"},"keywords":["error","generate","pretty","print","show","mistake"],"author":{"name":"Francisco Presencia","email":"public@francisco.io","url":"http://francisco.io/"},"license":"MIT","bugs":{"url":"https://github.com/franciscop/human-error/issues"},"homepage":"https://github.com/franciscop/human-error#readme","gitHead":"763cbc0153fce761fb19dff2899b019525acd622","_id":"human-error@0.1.0","_shasum":"4a92fb903d61b2d5b86810279b0fdea22b8cae19","_from":".","_npmVersion":"3.10.10","_nodeVersion":"7.2.1","_npmUser":{"name":"franciscop","email":"public@francisco.io"},"dist":{"shasum":"4a92fb903d61b2d5b86810279b0fdea22b8cae19","size":2870,"noattachment":false,"key":"/human-error/-/human-error-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/human-error/download/human-error-0.1.0.tgz"},"maintainers":[{"name":"franciscop","email":"developerfrancisco@hotmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/human-error-0.1.0.tgz_1485553236200_0.2760108797810972"},"directories":{},"publish_time":1485553236818,"_cnpm_publish_time":1485553236818,"_hasShrinkwrap":false}},"readme":"# human-error [![CircleCI](https://circleci.com/gh/franciscop/human-error.svg?style=shield)](https://circleci.com/gh/franciscop/human-error)\n\nAllows you to write errors so people can understand:\n\n| [![Show an error in the code](img/meta-run.png)](img/meta-run.png)  | [![Show an error in the code](img/meta-jest.png)](img/meta-jest.png)\n|:---:|:---:|\n| An error while running `node app.js` | Same error while testing with `jest` |\n\n\n\n## Getting started\n\nInstall it with NPM:\n\n```bash\nnpm install human-error\n```\n\nThen create your error codes:\n\n```js\n// myfun-errors.js\nconst errors = require('human-error')({\n  // [optional] a url where the error is explained in-depth\n  url: name => `http://example.com/error/${name}`\n});\n\n// \"NAMESPACE\" can be whatever you want (or nothing at all)\nerrors['NAMESPACE.missingcallback'] = () => `\n  myFun() expects a callback to be passed but nothing was passed.\n`;\n\nerrors['NAMESPACE.invalidcallback'] = ({ type }) => `\n  myFun() expects the argument to be a callback function.\n  ${type ? `\"${type}\" was passed instead.` : ''}\n`;\n\nmodule.exports = errors;\n```\n\nThen use them in your code:\n\n```js\n// myfun.js\nconst errors = require('./myfun-errors');\n\nmodule.exports = (cb) => {\n  if (!cb) {\n    throw errors('NAMESPACE.missingcallback');\n  }\n  if (!(cb instanceof Function)) {\n    throw errors('NAMESPACE.invalidcallback', { type: typeof cb });\n  }\n  cb('Cool library!');\n};\n```\n\n\n## Options\n\n- `url` [false]: if there's an url to show more info. It can be a string in which case it will just be printed or a function that build the error such as `(key) => 'https://example.com/errors#' + key` so you can show the appropriate support url.\n- `extra` [{}]: an object that defaults to all of the options in the namespace. Useful for example for status code errors (`status: 500`) etc.\n- `width` [80]: the minimum width of the row. It cannot cut strings since links shouldn't be cut.\n- `plain` [false]: avoid generating a table and using plain-text only, in case some things break.\n","_attachments":{},"homepage":"https://github.com/franciscop/human-error#readme","bugs":{"url":"https://github.com/franciscop/human-error/issues"},"license":"MIT"}