117 lines
6.9 KiB
JSON
117 lines
6.9 KiB
JSON
{
|
|
"_args": [
|
|
[
|
|
{
|
|
"raw": "error-ex@^1.2.0",
|
|
"scope": null,
|
|
"escapedName": "error-ex",
|
|
"name": "error-ex",
|
|
"rawSpec": "^1.2.0",
|
|
"spec": ">=1.2.0 <2.0.0",
|
|
"type": "range"
|
|
},
|
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/parse-json"
|
|
]
|
|
],
|
|
"_from": "error-ex@>=1.2.0 <2.0.0",
|
|
"_id": "error-ex@1.3.1",
|
|
"_inCache": true,
|
|
"_location": "/error-ex",
|
|
"_nodeVersion": "4.4.3",
|
|
"_npmOperationalInternal": {
|
|
"host": "packages-12-west.internal.npmjs.com",
|
|
"tmp": "tmp/error-ex-1.3.1.tgz_1488583539188_0.11632813210599124"
|
|
},
|
|
"_npmUser": {
|
|
"name": "qix",
|
|
"email": "i.am.qix@gmail.com"
|
|
},
|
|
"_npmVersion": "2.15.1",
|
|
"_phantomChildren": {},
|
|
"_requested": {
|
|
"raw": "error-ex@^1.2.0",
|
|
"scope": null,
|
|
"escapedName": "error-ex",
|
|
"name": "error-ex",
|
|
"rawSpec": "^1.2.0",
|
|
"spec": ">=1.2.0 <2.0.0",
|
|
"type": "range"
|
|
},
|
|
"_requiredBy": [
|
|
"/parse-json"
|
|
],
|
|
"_resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz",
|
|
"_shasum": "f855a86ce61adc4e8621c3cda21e7a7612c3a8dc",
|
|
"_shrinkwrap": null,
|
|
"_spec": "error-ex@^1.2.0",
|
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/parse-json",
|
|
"bugs": {
|
|
"url": "https://github.com/qix-/node-error-ex/issues"
|
|
},
|
|
"dependencies": {
|
|
"is-arrayish": "^0.2.1"
|
|
},
|
|
"description": "Easy error subclassing and stack customization",
|
|
"devDependencies": {
|
|
"coffee-script": "^1.9.3",
|
|
"coveralls": "^2.11.2",
|
|
"istanbul": "^0.3.17",
|
|
"mocha": "^2.2.5",
|
|
"should": "^7.0.1",
|
|
"xo": "^0.7.1"
|
|
},
|
|
"directories": {},
|
|
"dist": {
|
|
"shasum": "f855a86ce61adc4e8621c3cda21e7a7612c3a8dc",
|
|
"tarball": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz"
|
|
},
|
|
"files": [
|
|
"index.js"
|
|
],
|
|
"gitHead": "002e0ffd7ae9e3427555459c132e823251d7e195",
|
|
"homepage": "https://github.com/qix-/node-error-ex#readme",
|
|
"keywords": [
|
|
"error",
|
|
"errors",
|
|
"extend",
|
|
"extending",
|
|
"extension",
|
|
"subclass",
|
|
"stack",
|
|
"custom"
|
|
],
|
|
"license": "MIT",
|
|
"maintainers": [
|
|
{
|
|
"name": "Josh Junon",
|
|
"email": "i.am.qix@gmail.com",
|
|
"url": "github.com/qix-"
|
|
},
|
|
{
|
|
"name": "Sindre Sorhus",
|
|
"email": "sindresorhus@gmail.com",
|
|
"url": "sindresorhus.com"
|
|
}
|
|
],
|
|
"name": "error-ex",
|
|
"optionalDependencies": {},
|
|
"readme": "# node-error-ex [![Travis-CI.org Build Status](https://img.shields.io/travis/Qix-/node-error-ex.svg?style=flat-square)](https://travis-ci.org/Qix-/node-error-ex) [![Coveralls.io Coverage Rating](https://img.shields.io/coveralls/Qix-/node-error-ex.svg?style=flat-square)](https://coveralls.io/r/Qix-/node-error-ex)\n> Easily subclass and customize new Error types\n\n## Examples\nTo include in your project:\n```javascript\nvar errorEx = require('error-ex');\n```\n\nTo create an error message type with a specific name (note, that `ErrorFn.name`\nwill not reflect this):\n```javascript\nvar JSONError = errorEx('JSONError');\n\nvar err = new JSONError('error');\nerr.name; //-> JSONError\nthrow err; //-> JSONError: error\n```\n\nTo add a stack line:\n```javascript\nvar JSONError = errorEx('JSONError', {fileName: errorEx.line('in %s')});\n\nvar err = new JSONError('error')\nerr.fileName = '/a/b/c/foo.json';\nthrow err; //-> (line 2)-> in /a/b/c/foo.json\n```\n\nTo append to the error message:\n```javascript\nvar JSONError = errorEx('JSONError', {fileName: errorEx.append('in %s')});\n\nvar err = new JSONError('error');\nerr.fileName = '/a/b/c/foo.json';\nthrow err; //-> JSONError: error in /a/b/c/foo.json\n```\n\n## API\n\n#### `errorEx([name], [properties])`\nCreates a new ErrorEx error type\n\n- `name`: the name of the new type (appears in the error message upon throw;\n defaults to `Error.name`)\n- `properties`: if supplied, used as a key/value dictionary of properties to\n use when building up the stack message. Keys are property names that are\n looked up on the error message, and then passed to function values.\n\t- `line`: if specified and is a function, return value is added as a stack\n entry (error-ex will indent for you). Passed the property value given\n the key.\n - `stack`: if specified and is a function, passed the value of the property\n using the key, and the raw stack lines as a second argument. Takes no\n return value (but the stack can be modified directly).\n - `message`: if specified and is a function, return value is used as new\n `.message` value upon get. Passed the property value of the property named\n by key, and the existing message is passed as the second argument as an\n array of lines (suitable for multi-line messages).\n\nReturns a constructor (Function) that can be used just like the regular Error\nconstructor.\n\n```javascript\nvar errorEx = require('error-ex');\n\nvar BasicError = errorEx();\n\nvar NamedError = errorEx('NamedError');\n\n// --\n\nvar AdvancedError = errorEx('AdvancedError', {\n\tfoo: {\n\t\tline: function (value, stack) {\n\t\t\tif (value) {\n\t\t\t\treturn 'bar ' + value;\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n}\n\nvar err = new AdvancedError('hello, world');\nerr.foo = 'baz';\nthrow err;\n\n/*\n\tAdvancedError: hello, world\n\t bar baz\n\t at tryReadme() (readme.js:20:1)\n*/\n```\n\n#### `errorEx.line(str)`\nCreates a stack line using a delimiter\n\n> This is a helper function. It is to be used in lieu of writing a value object\n> for `properties` values.\n\n- `str`: The string to create\n - Use the delimiter `%s` to specify where in the string the value should go\n\n```javascript\nvar errorEx = require('error-ex');\n\nvar FileError = errorEx('FileError', {fileName: errorEx.line('in %s')});\n\nvar err = new FileError('problem reading file');\nerr.fileName = '/a/b/c/d/foo.js';\nthrow err;\n\n/*\n\tFileError: problem reading file\n\t in /a/b/c/d/foo.js\n\t at tryReadme() (readme.js:7:1)\n*/\n```\n\n#### `errorEx.append(str)`\nAppends to the `error.message` string\n\n> This is a helper function. It is to be used in lieu of writing a value object\n> for `properties` values.\n\n- `str`: The string to append\n - Use the delimiter `%s` to specify where in the string the value should go\n\n```javascript\nvar errorEx = require('error-ex');\n\nvar SyntaxError = errorEx('SyntaxError', {fileName: errorEx.append('in %s')});\n\nvar err = new SyntaxError('improper indentation');\nerr.fileName = '/a/b/c/d/foo.js';\nthrow err;\n\n/*\n\tSyntaxError: improper indentation in /a/b/c/d/foo.js\n\t at tryReadme() (readme.js:7:1)\n*/\n```\n\n## License\nLicensed under the [MIT License](http://opensource.org/licenses/MIT).\nYou can find a copy of it in [LICENSE](LICENSE).\n",
|
|
"readmeFilename": "README.md",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/qix-/node-error-ex.git"
|
|
},
|
|
"scripts": {
|
|
"pretest": "xo",
|
|
"test": "mocha --compilers coffee:coffee-script/register"
|
|
},
|
|
"version": "1.3.1",
|
|
"xo": {
|
|
"rules": {
|
|
"operator-linebreak": [
|
|
0
|
|
]
|
|
}
|
|
}
|
|
}
|