{"name":"explain-error","description":"wrap errors in explainations.","version":"1.0.2","homepage":"https://github.com/dominictarr/explain-error","repository":{"type":"git","url":"git://github.com/dominictarr/explain-error.git"},"scripts":{"test":"set -e; for t in test/*.js; do node $t; done"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://dominictarr.com"},"license":"MIT","gitHead":"f988f79c9dd8feff381d3a5c6de690f383304d72","bugs":{"url":"https://github.com/dominictarr/explain-error/issues"},"_id":"explain-error@1.0.2","_shasum":"d7a78dd9f6d3e638343b96aecece5481d5864f93","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"dist":{"shasum":"d7a78dd9f6d3e638343b96aecece5481d5864f93","tarball":"http://registry-npm.ywwl.com/explain-error/download/explain-error-1.0.2.tgz","integrity":"sha512-6APgjChYVxPrewjsiCPvmHgIILbXDF8UiDINmcQNbS0D8pulLeQ28W74M6AuOiRneajb7YnqJFP8g97CluIy3Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDOIPnTdj6YCItVKYuZ47zc2MB4/e0xh4UROLb1j/t9dAIgPyBuG0HO/AzzX73rU/WYJniYM+2OhRg4Vam9ik3btig="}],"size":1997,"noattachment":false,"key":"/explain-error/-/explain-error-1.0.2.tgz"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/explain-error-1.0.2.tgz_1468115047711_0.5680257929489017"},"directories":{},"readme":"# explain-error\n\nwrap errors in explainations.\n\nIn node sometimes something fails because of some internal detail,\nbut then this error may be passed back somewhere else, too often,\ncontext is lost.\n\n## example\n\n``` js\nvar explain = require('explain-error')\n\n//stat a file that does not exist. this will error, add an explaination.\nfunction explainedError(cb) {\n  require('fs').stat('neoatuhrcoahkrcophkr', function (err) {\n    if(err) cb(explain(err, 'asked for a file that certainly did not exist'))\n    else cb()\n  })\n}\n\n//show that this works even with multiple layers of explainations.\nexplainedError(function (err) {\n  throw explain(err, 'called an function that was expected to fail')\n})\n```\n\noutput:\n\n`fs.stat` does not show where it was called from,\nbut at least now you know what happened after that.\n\n```\nError: called an function that was expected to fail\n    at /home/dominic/c/explain-error/example.js:11:9\n    at /home/dominic/c/explain-error/example.js:5:13\n  Error: asked for a file that certainly did not exist\n    at /home/dominic/c/explain-error/example.js:5:16\n    at Object.oncomplete (fs.js:107:15)\n  Error: ENOENT, stat neoatuhrcoahkrcophkr\n\n```\n\n## parsing stack traces\n\nof course, this adds lines to your errors that will do not look like normal js errors.\nwill this break all your tools? if so please post an issue.\n\n## License\n\nMIT\n","publish_time":1468115048191,"_cnpm_publish_time":1468115048191,"dist-tags":{"latest":"1.0.4"}}