{
  "name": "clarify-error",
  "version": "1.0.0",
  "description": "Add some additional context to a JavaScript error",
  "author": "Andre Staltz <contact@staltz.com>",
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/staltz/clarify-error.git"
  },
  "main": "lib/index.js",
  "types": "lib/index.d.ts",
  "files": [
    "lib/*"
  ],
  "engines": {
    "node": ">=10"
  },
  "devDependencies": {
    "@types/node": "^14.14.39",
    "c8": "^7.11.0",
    "tap-spec": "^5.0.0",
    "tape": "^5.2.2",
    "typescript": "~4.6.2"
  },
  "scripts": {
    "compile": "tsc",
    "test": "npm run compile && npm run tape",
    "tape": "tape test/*.js | tap-spec",
    "coverage": "c8 npm run test"
  },
  "readme": "# clarify-error\n\nWrap errors in explanations.\n\n> This is a spiritual successor to [explain-error](https://github.com/dominictarr/explain-error), rewritten after 8 years, using TypeScript, fixing some quirks and achieving 100%\ntest coverage.\n\nIn Node.js sometimes something fails because of some internal detail, but then\nthis error may be passed back somewhere else, too often, context is lost.\n\n## Example\n\n```js\nconst fs = require('fs')\nconst explain = require('explain-error')\n\n// stat a file that does not exist. this will error, so add an explanation.\nfunction explainedError(cb) {\n  fs.stat('neoatuhrcoahkrcophkr', (err) => {\n    if (err) cb(explain(err, 'asked for a file that certainly did not exist'))\n    else cb()\n  })\n}\n\n// this works even with multiple layers of explanations.\nexplainedError(function (err) {\n  throw explain(err, 'called an function that was expected to fail')\n})\n```\n\n**Output:**\n\n`fs.stat` does not show where it was called from, but at least now you know what\nhappened after that.\n\n```\nError: called an function that was expected to fail\n    at /home/staltz/oss/wrap-error/example.js:11:9\n    at /home/staltz/oss/wrap-error/example.js:5:14\n  Error: asked for a file that certainly did not exist\n    at /home/staltz/oss/wrap-error/example.js:5:17\n    at FSReqCallback.oncomplete (fs.js:168:21)\n  Error: ENOENT: no such file or directory, stat 'neoatuhrcoahkrcophkr'\n```\n\n## License\n\nMIT\n"
}