{"_id":"errio","_rev":"18-0196965b2857090e5f8a7ed5b330c45b","name":"errio","description":"Error serialization and deserialization","dist-tags":{"latest":"1.2.2"},"versions":{"0.1.0":{"name":"errio","version":"0.1.0","description":"Error serialization and deserialization","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/programble/errio"},"keywords":["error","serialization","deserialization","json"],"author":{"name":"Curtis McEnroe","email":"curtis@cmcenroe.me","url":"http://cmcenroe.me"},"license":"ISC","bugs":{"url":"https://github.com/programble/errio/issues"},"homepage":"https://github.com/programble/errio","gitHead":"6975938a3490d4f91a9698d01b555cf1eb90f8f1","_id":"errio@0.1.0","_shasum":"454a3d6558f8fd0a123c97db04142380f8c0784a","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"programble","email":"programble@gmail.com"},"maintainers":[{"name":"programble","email":"programble@gmail.com"}],"dist":{"shasum":"454a3d6558f8fd0a123c97db04142380f8c0784a","tarball":"https://registry.npmjs.org/errio/-/errio-0.1.0.tgz","integrity":"sha512-i1fs9PEHCHhf/u5sD/XvTJvcXDM8HYZf6h/Ml3thFdjOqp9QWoFgW/5pTztS+D8z+6q3gdV1/rNzJ5PXpaJWyg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGiOiEAj9elNHjKeOE85zZzh4owbvN1TUdB6TTlekC3BAiEAutlOLrDs6dJQPmVQuYacHitBHPNblt9iWXN0xBAxmNw="}]},"directories":{}},"1.0.0":{"name":"errio","version":"1.0.0","description":"Error serialization and deserialization","main":"index.js","scripts":{"test":"NODE_ENV=test node_modules/.bin/mocha","coverage":"NODE_ENV=test node_modules/.bin/istanbul cover node_modules/.bin/_mocha","coveralls":"cat coverage/lcov.info | node_modules/.bin/coveralls","clean":"rm -rf coverage"},"repository":{"type":"git","url":"https://github.com/programble/errio"},"keywords":["error","serialization","deserialization","json"],"author":{"name":"Curtis McEnroe","email":"curtis@cmcenroe.me","url":"http://cmcenroe.me"},"license":"ISC","bugs":{"url":"https://github.com/programble/errio/issues"},"homepage":"https://github.com/programble/errio","devDependencies":{"coveralls":"^2.11.2","istanbul":"^0.3.5","mocha":"^2.1.0","super-error":"^1.1.0"},"gitHead":"7c344c821e9ec06aac739246fa452c708ab089ef","_id":"errio@1.0.0","_shasum":"f44a53399221453b52d8a948158a66d560c1c0d9","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"programble","email":"programble@gmail.com"},"maintainers":[{"name":"programble","email":"programble@gmail.com"}],"dist":{"shasum":"f44a53399221453b52d8a948158a66d560c1c0d9","tarball":"https://registry.npmjs.org/errio/-/errio-1.0.0.tgz","integrity":"sha512-/ejPe6c+e1GHxw0fW3RgyzbqPgs1a9rv1t/aEHUGi/HLWxVbEitk49HKHhfF6Lu032tmRKF+KeUwoWR72qvLAg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0qrVCe/QtXC4ynQ3znsAZgoLFpHwdzegIwHtJyg6TQgIgKx8RI01XVUBYEPAQ18/W1uQlgrFGI8PylGt7H1KCvQA="}]},"directories":{}},"1.1.0":{"name":"errio","version":"1.1.0","description":"Error serialization and deserialization","main":"index.js","scripts":{"test":"NODE_ENV=test node_modules/.bin/mocha","coverage":"NODE_ENV=test node_modules/.bin/istanbul cover node_modules/.bin/_mocha","coveralls":"cat coverage/lcov.info | node_modules/.bin/coveralls","clean":"rm -rf coverage"},"repository":{"type":"git","url":"https://github.com/programble/errio"},"keywords":["error","serialization","deserialization","json"],"author":{"name":"Curtis McEnroe","email":"curtis@cmcenroe.me","url":"http://cmcenroe.me"},"license":"ISC","bugs":{"url":"https://github.com/programble/errio/issues"},"homepage":"https://github.com/programble/errio","devDependencies":{"coveralls":"^2.11.2","istanbul":"^0.3.5","mocha":"^2.1.0","super-error":"^1.1.0"},"gitHead":"63b6275829b007bb4f07bf8c6862c0c1524f0f1d","_id":"errio@1.1.0","_shasum":"a1926c88134c7da05d2096038e6f97b625fd3e1a","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"programble","email":"programble@gmail.com"},"maintainers":[{"name":"programble","email":"programble@gmail.com"}],"dist":{"shasum":"a1926c88134c7da05d2096038e6f97b625fd3e1a","tarball":"https://registry.npmjs.org/errio/-/errio-1.1.0.tgz","integrity":"sha512-oRNsrcK046MkSFQnjRKZVu5j8peh3e9H2uqLPM57Dg+zW8m5Cp0O1k4HJV7OJQx5dHuVJdvcGW0IETRE1pw3Hw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDSWdgOSDf3D7kMbQvUDhtpPD6QCXv8nWFSr3Uwv0+aCgIgEnNsgwzb/NcRnbWI+yS4AFmo1PWIQPbj/EwfT5Cu9VU="}]},"directories":{}},"1.1.1":{"name":"errio","version":"1.1.1","description":"Error serialization and deserialization","main":"index.js","scripts":{"test":"NODE_ENV=test node_modules/.bin/mocha","coverage":"NODE_ENV=test node_modules/.bin/istanbul cover node_modules/.bin/_mocha","coveralls":"cat coverage/lcov.info | node_modules/.bin/coveralls","clean":"rm -rf coverage"},"repository":{"type":"git","url":"https://github.com/programble/errio"},"keywords":["error","serialization","deserialization","json"],"author":{"name":"Curtis McEnroe","email":"curtis@cmcenroe.me","url":"http://cmcenroe.me"},"license":"ISC","bugs":{"url":"https://github.com/programble/errio/issues"},"homepage":"https://github.com/programble/errio","devDependencies":{"coveralls":"^2.11.2","istanbul":"^0.3.5","mocha":"^2.1.0","super-error":"^1.1.0"},"gitHead":"e98018bbe554c9e7125a3f7f4c11b7add3e02546","_id":"errio@1.1.1","_shasum":"89adf5fbd2cb0e6d20a461126a55582da9bcf8fa","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"programble","email":"programble@gmail.com"},"maintainers":[{"name":"programble","email":"programble@gmail.com"}],"dist":{"shasum":"89adf5fbd2cb0e6d20a461126a55582da9bcf8fa","tarball":"https://registry.npmjs.org/errio/-/errio-1.1.1.tgz","integrity":"sha512-N80b/fHvYd4WPGlnDZrBoUuDQqIdbaIP/OWeycxQPExkWv0Gc33x+Dwb7V2AuTbGhR62IxklgCjWe6OVXwiJuQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCc8aEAcCsilAOcLn4vukCl7AuBEEAUew6CJN7UuaZ4EAIgSl/iATtRmgAwdH46o29bLckiZKnGWLymfEqhdI0ipiA="}]},"directories":{}},"1.1.2":{"name":"errio","version":"1.1.2","description":"Error serialization and deserialization","main":"index.js","scripts":{"test":"NODE_ENV=test node_modules/.bin/mocha","coverage":"NODE_ENV=test node_modules/.bin/istanbul cover node_modules/.bin/_mocha","coveralls":"cat coverage/lcov.info | node_modules/.bin/coveralls","clean":"rm -rf coverage"},"repository":{"type":"git","url":"https://github.com/programble/errio"},"keywords":["error","serialization","deserialization","json"],"author":{"name":"Curtis McEnroe","email":"curtis@cmcenroe.me","url":"http://cmcenroe.me"},"license":"ISC","bugs":{"url":"https://github.com/programble/errio/issues"},"homepage":"https://github.com/programble/errio","devDependencies":{"coveralls":"^2.11.2","istanbul":"^0.3.5","mocha":"^2.1.0","super-error":"^1.1.0"},"gitHead":"325beb0becd0bcf667c9fdd3e3255e92e0d9b60e","_id":"errio@1.1.2","_shasum":"e5589e9accc55188b4f936c78060c85075cc81f6","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"programble","email":"programble@gmail.com"},"maintainers":[{"name":"programble","email":"programble@gmail.com"}],"dist":{"shasum":"e5589e9accc55188b4f936c78060c85075cc81f6","tarball":"https://registry.npmjs.org/errio/-/errio-1.1.2.tgz","integrity":"sha512-jntUl5qduzP3HkB4KqKDGNi9nA9A1zLNSEwgeNiUUScefWm25pKaSvnsSm/YMOLX35CIsQOq0epkXZXdwFry9w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDOY8v85EYRdYwe6Qt2kP6Dwq3UjwJNXTd5pNk7y9yFwgIgDeBV+dUBIQg9qmAdp8DBtJyXN9iX/sZEFZ7Uc6/yzpE="}]},"directories":{}},"1.2.0":{"name":"errio","version":"1.2.0","description":"Error serialization and deserialization","main":"index.js","scripts":{"test":"NODE_ENV=test node_modules/.bin/mocha","coverage":"NODE_ENV=test node_modules/.bin/istanbul cover node_modules/.bin/_mocha","coveralls":"cat coverage/lcov.info | node_modules/.bin/coveralls","clean":"rm -rf coverage"},"repository":{"type":"git","url":"https://github.com/programble/errio"},"keywords":["error","serialization","deserialization","json"],"author":{"name":"Curtis McEnroe","email":"curtis@cmcenroe.me","url":"http://cmcenroe.me"},"license":"ISC","bugs":{"url":"https://github.com/programble/errio/issues"},"homepage":"https://github.com/programble/errio","devDependencies":{"coveralls":"^2.11.2","istanbul":"^0.3.5","mocha":"^2.1.0","super-error":"^1.1.0"},"gitHead":"c55816bb06c86fdf9146713863f9ae9a6a4772ab","_id":"errio@1.2.0","_shasum":"6a04e248b5306d3ff20218ab4bb68eb8e942378d","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"programble","email":"programble@gmail.com"},"maintainers":[{"name":"programble","email":"programble@gmail.com"}],"dist":{"shasum":"6a04e248b5306d3ff20218ab4bb68eb8e942378d","tarball":"https://registry.npmjs.org/errio/-/errio-1.2.0.tgz","integrity":"sha512-WPg74z5/GzmczxLfORYFtmQikr3ZKMJgGw5ieHFI8w51mHIdFRoNRlpwyFtxZjGSWZYLRu18WE6BMF5fss0XUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHmZ8vJGEl5C9OXZyYRtfo5RHYCPBSk79xzRQsyDo3zWAiEAh4A8w70evH1u1KMeZuaqbgUyuTTWpeetcI4Mw/d/23k="}]},"directories":{}},"1.2.1":{"name":"errio","version":"1.2.1","description":"Error serialization and deserialization","main":"index.js","scripts":{"test":"NODE_ENV=test node_modules/.bin/mocha","coverage":"NODE_ENV=test node_modules/.bin/istanbul cover node_modules/.bin/_mocha","coveralls":"cat coverage/lcov.info | node_modules/.bin/coveralls","clean":"rm -rf coverage"},"repository":{"type":"git","url":"https://github.com/programble/errio"},"keywords":["error","serialization","deserialization","json"],"author":{"name":"Curtis McEnroe","email":"curtis@cmcenroe.me","url":"http://cmcenroe.me"},"license":"ISC","bugs":{"url":"https://github.com/programble/errio/issues"},"homepage":"https://github.com/programble/errio","devDependencies":{"coveralls":"^2.11.2","istanbul":"^0.3.5","mocha":"^2.1.0","super-error":"^1.1.0"},"gitHead":"4cf286753637029d352148886329fa0bfd569df9","_id":"errio@1.2.1","_shasum":"e1c02c1802d3b713faeac52a05131bac79902e0b","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"programble","email":"programble@gmail.com"},"maintainers":[{"name":"programble","email":"programble@gmail.com"}],"dist":{"shasum":"e1c02c1802d3b713faeac52a05131bac79902e0b","tarball":"https://registry.npmjs.org/errio/-/errio-1.2.1.tgz","integrity":"sha512-jtXn9f7t83DLicqjnQMomDVL2EMqACmpAgSX3GrLzlYWhDeY8t3IwRjUSlSY2rWyCyongQ3V3OBr3sgFP6W78g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDthCsnCnjp9EXhvcccob0NDuscs6nqkFSufcb12+8IFgIhAPYoraZH2KAWRCM9DkaJdhSBDaCjYJb/PXKPA4DUnpXw"}]},"directories":{}},"1.2.2":{"name":"errio","version":"1.2.2","description":"Error serialization and deserialization","main":"index.js","scripts":{"test":"NODE_ENV=test node_modules/.bin/mocha","coverage":"NODE_ENV=test node_modules/.bin/istanbul cover node_modules/.bin/_mocha","coveralls":"cat coverage/lcov.info | node_modules/.bin/coveralls","clean":"rm -rf coverage"},"repository":{"type":"git","url":"git+https://github.com/programble/errio.git"},"keywords":["error","serialization","deserialization","json"],"author":{"name":"Curtis McEnroe","email":"curtis@cmcenroe.me","url":"http://cmcenroe.me"},"license":"ISC","bugs":{"url":"https://github.com/programble/errio/issues"},"homepage":"https://github.com/programble/errio","devDependencies":{"coveralls":"^2.11.2","istanbul":"^0.3.5","mocha":"^2.1.0","super-error":"^1.1.0"},"gitHead":"ec23953f751c3c7cc5e6f1cb08dbe859066c3179","_id":"errio@1.2.2","_shasum":"2430afa66fa6dc363db588c3d83c4407a85d0255","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"programble","email":"programble@gmail.com"},"dist":{"shasum":"2430afa66fa6dc363db588c3d83c4407a85d0255","tarball":"https://registry.npmjs.org/errio/-/errio-1.2.2.tgz","integrity":"sha512-Le3X3pR2h4qtAJXFyOEfMf9xsfy6v3Lb7Xbpf1/Wyux0lZfV6+vNoWWiqNjdCFrzrj+esQ2HwdK1/KkdgzrbKg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCh5kCBlowOI5R1ekcbLJ+JroXj6UC8X0HIp75gx+6Y9QIhAKIF9Kag6Gsx6TPQzATEcyrU4E9KV4GrAX2e+nrLlX1N"}]},"maintainers":[{"name":"programble","email":"programble@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/errio-1.2.2.tgz_1487795548781_0.5299584344029427"},"directories":{}}},"readme":"# Errio\n\n[![npm](https://img.shields.io/npm/v/errio.svg?style=flat-square)](https://www.npmjs.com/package/errio)\n[![Travis](https://img.shields.io/travis/programble/errio.svg?style=flat-square)](https://travis-ci.org/programble/errio)\n[![Coveralls](https://img.shields.io/coveralls/programble/errio.svg?style=flat-square)](https://coveralls.io/r/programble/errio)\n\nError serialization and deserialization.\n\n```\nnpm install errio\n```\n\n## Overview\n\nJavaScript errors don't serialize well.\n\n```javascript\n> JSON.stringify(new Error('help'));\n'{}'\n```\n\nAnd they certainly don't deserialize well.\n\n```javascript\n> JSON.parse('{}');\n{}\n```\n\nErrio serializes errors to meaningful JSON.\n\n```javascript\n> Errio.stringify(new Error('serialize me'));\n'{\"name\":\"Error\",\"message\":\"serialize me\"}'\n```\n\nAnd deserializes JSON back into error instances.\n\n```javascript\n> Errio.parse('{\"name\":\"Error\",\"message\":\"serialize me\"}');\n[Error: serialize me]\n```\n\n## Example\n\nConsult the [API Documentation][docs] for details on the functions used.\n\nThis example uses [SuperError][super-error], a library for easily\nsubclassing errors in Node.js.\n\n```javascript\nvar Errio = require('errio');\nvar SuperError = require('super-error');\nvar fs = require('fs');\n\n// Create a new Error subclass with a custom constructor.\nvar MyError = SuperError.subclass('MyError', function(code, message) {\n  this.code = code;\n  this.message = message;\n});\n\n// Register the class with Errio.\nErrio.register(MyError);\n\n// Create an error instance.\nvar error = new MyError(420, 'Enhance Your Calm');\n\n// Save the error somewhere.\nfs.writeFileSync('error.json', Errio.stringify(error));\n\n// Load the error from somewhere.\nvar loadedError = Errio.parse(fs.readFileSync('error.json'));\n\n// Throw as usual.\ntry {\n  throw loadedError;\n} catch (thrown) {\n  // Check class as usual.\n  if (thrown instanceof MyError) {\n    console.log(thrown.code); // And access properties as usual.\n  }\n}\n```\n\n[super-error]: https://github.com/busbud/super-error\n[docs]: #api-documentation\n\n## API Documentation\n\n```javascript\nvar Errio = require('errio');\n```\n\n### Options\n\nOptions can be set at a global defaults level, at the error class level\nand at the individual call level. Listed below are the available options\nand their factory default values.\n\n- `recursive: true`: Recursively serialize and deserialize nested errors\n- `inherited: true`: Include inherited properties\n- `stack: false`: Include the stack trace\n- `private: false`: Include properties with leading or trailing\n  underscores in serialization\n- `exclude: []`: Property names to exclude (low priority)\n- `include: []`: Property names to include (high priority)\n\n### Errio.setDefaults(options)\n\nOverwrite the global default options with the plain object `options`.\nOption keys missing from `options` are left unchanged.\n\n### Errio.register(constructor, options)\n\nRegister an error constructor for serialization and deserialization with\noption overrides.\n\nThe error name will be taken from the first of these that is set:\n\n1. `options.name`\n2. `constructor.prototype.name`, if it is not 'Error'\n3. `constructor.name`\n4. `new constructor().name`\n\nNote that in the last case, the constructor is instantiated with no arguments.\n\nAll [built-in error classes][builtins] are automatically registered with\nno option overrides.\n\nCan be called more than once for the same error constructor in order to\nreplace the option overrides.\n\n[builtins]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types\n\n### Errio.registerAll(constructors, options)\n\nRegister an array of error constructors with the same option overrides.\n\nNames cannot be specified in `options`, so all constructors will be\ninstantiated to infer their names.\n\n### Errio.registerObject(constructors, options)\n\nRegister a plain object of error names mapped to constructors with the\nsame option overrides. Constructors will not be instantiated.\n\nPerfect for registering error classes exported from a module.\n\n### Errio.toObject(error, options)\n\nSerialize an error instance to a plain object with option overrides.\n\nPassed options take priority over registered error class options and the\nglobal defaults.\n\nIf the class of the error instance has not been registered, it is\nautomatically registered with the options passed to the call.\n\nReturned objects always contain `name` and `message` properties.\n\n### Errio.fromObject(object, options)\n\nDeserialize a plain object to an instance of a registered error class.\n\nIf the class of the serialized error has no registered constructor,\nreturn an instance of `Error` with the `name` property set.\n\nIf the stack was not serialized, capture a new stack trace from the\ncaller.\n\n### Errio.stringify(error, options)\n\nSerialize an error instance to a JSON string. Convenience wrapper for\n`Errio.toObject`.\n\n### Errio.parse(string, options)\n\nDeserialize a JSON string to an instance of a registered error class.\nConvenience wrapper for `Errio.fromObject`.\n\n## License\n\nCopyright © 2015, Curtis McEnroe <curtis@cmcenroe.me>\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n","maintainers":[{"email":"npm@npmjs.com","name":"npm"}],"time":{"modified":"2022-06-17T08:12:04.450Z","created":"2014-12-31T05:38:32.765Z","0.1.0":"2014-12-31T05:38:32.765Z","1.0.0":"2015-01-10T22:08:46.695Z","1.1.0":"2015-02-10T03:11:21.086Z","1.1.1":"2015-02-16T20:14:59.141Z","1.1.2":"2015-02-16T20:33:39.719Z","1.2.0":"2015-03-10T03:02:35.219Z","1.2.1":"2015-03-16T22:52:08.610Z","1.2.2":"2017-02-22T20:32:30.474Z"},"homepage":"https://github.com/programble/errio","keywords":["error","serialization","deserialization","json"],"repository":{"type":"git","url":"git+https://github.com/programble/errio.git"},"author":{"name":"Curtis McEnroe","email":"curtis@cmcenroe.me","url":"http://cmcenroe.me"},"bugs":{"url":"https://github.com/programble/errio/issues"},"license":"ISC","readmeFilename":"README.md"}