{"name":"explain-error","description":"wrap errors in explainations.","version":"1.0.0","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":"2a18c24d9c361d2d91bc6d9ede862265bfa14fc5","bugs":{"url":"https://github.com/dominictarr/explain-error/issues"},"_id":"explain-error@1.0.0","_shasum":"37e66be4b22848ee9d8df9e958167d33309404b4","_from":".","_npmVersion":"1.4.26","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"dist":{"shasum":"37e66be4b22848ee9d8df9e958167d33309404b4","tarball":"http://registry-npm.ywwl.com/explain-error/download/explain-error-1.0.0.tgz","integrity":"sha512-uwheiVjqCK1s5MMXLtcV7hz3zq6v8U89UIjnK4ODcNvnoKl3xJ+sH5Inon2czyTHHe2z36yNh+Oj8tcnvhvcsQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDPSsqp3widj1WqS27LpqLewrrF3emQAhwpaRF6KouL0AiEAuDe65gG1dm3RyXhPtfppUfLkfETvGaKULah3sboHeNk="}],"size":2002,"noattachment":false,"key":"/explain-error/-/explain-error-1.0.0.tgz"},"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":1416314077311,"_cnpm_publish_time":1416314077311,"dist-tags":{"latest":"1.0.4"}}