{"_id":"mongoose-error","_rev":"33-099bda1ac755a8f7981c2930e971d49c","name":"mongoose-error","dist-tags":{"latest":"1.0.1"},"versions":{"0.0.1":{"name":"mongoose-error","version":"0.0.1","keywords":["mongoose","error"],"author":{"name":"Johan Preynat","email":"johan.preynat@gmail.com"},"license":"Apache-2.0","_id":"mongoose-error@0.0.1","maintainers":[{"name":"jpreynat","email":"johan.preynat@gmail.com"}],"contributors":[{"name":"Johan Preynat","email":"johan@gitbook.com"}],"dist":{"shasum":"a777a68b47c3822e7f0b4d14b5e2e2b53c789c77","tarball":"https://registry.npmjs.org/mongoose-error/-/mongoose-error-0.0.1.tgz","integrity":"sha512-8I6x669entCqKzXWmZyFatqLxXkeoYxMm0ixSuaGFO/ZnZUMAEaQ9SXquLhQBsqEAE+hj4rEGArf0lwkaJMAwA==","signatures":[{"sig":"MEQCIBSBN+Hv5IpgshA6fqeFIwzSjteO+TpxjCrf/2eD0dfcAiBFGjXX+nyaFF3UGFGfE5XgEzBo6idoiqAQiq/9HVMqUg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"a777a68b47c3822e7f0b4d14b5e2e2b53c789c77","engines":{"npm":"3.10.3","node":"6.4.0"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"jpreynat","email":"johan.preynat@gmail.com"},"_npmVersion":"3.10.3","description":"Small Node.js utility to normalize and handle mongoose errors","directories":{},"_nodeVersion":"6.4.0","dependencies":{"http-errors":"^1.5.0","mongo-errors":"^1.0.1"},"devDependencies":{"eslint":"^3.4.0"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-error-0.0.1.tgz_1472649851330_0.8195766340941191","host":"packages-16-east.internal.npmjs.com"}},"0.0.2":{"name":"mongoose-error","version":"0.0.2","keywords":["mongoose","error"],"author":{"name":"Johan Preynat","email":"johan.preynat@gmail.com"},"license":"Apache-2.0","_id":"mongoose-error@0.0.2","maintainers":[{"name":"jpreynat","email":"johan.preynat@gmail.com"}],"contributors":[{"name":"Johan Preynat","email":"johan@gitbook.com"}],"dist":{"shasum":"fa01050817284c128f242c714af3e6fb166cbf98","tarball":"https://registry.npmjs.org/mongoose-error/-/mongoose-error-0.0.2.tgz","integrity":"sha512-H6YRvghcbtDziayx35U/ZHg5AZxdWI6K5FTv1V9EtPL9ifMr64/gh9/Os7DyrJ15V0BNi7qdYD2jD6GCQ2Ch3Q==","signatures":[{"sig":"MEUCIDB2ueaPOXQXhV7HC7ng7crTuhEnlLHu9/HOFMajRy0pAiEAsDPG4e/y8+kqr+tNgiH3RHEEWOLU+jkNqrxlvj+kJpU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"fa01050817284c128f242c714af3e6fb166cbf98","engines":{"npm":"3.10.3","node":"6.4.0"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"jpreynat","email":"johan.preynat@gmail.com"},"_npmVersion":"3.10.3","description":"Small Node.js utility to normalize and handle mongoose errors","directories":{},"_nodeVersion":"6.4.0","dependencies":{"http-errors":"^1.5.0","mongo-errors":"^1.0.1"},"devDependencies":{"eslint":"^3.4.0"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-error-0.0.2.tgz_1472656826508_0.010973966680467129","host":"packages-12-west.internal.npmjs.com"}},"0.0.3":{"name":"mongoose-error","version":"0.0.3","keywords":["mongoose","error"],"author":{"name":"GitBook Team","email":"contact@gitbook.com"},"license":"Apache-2.0","_id":"mongoose-error@0.0.3","maintainers":[{"name":"aarono","email":"aaron.omullan@gmail.com"},{"name":"gitbook-bot","email":"contact@gitbook.com"},{"name":"jpreynat","email":"johan.preynat@gmail.com"},{"name":"mklabs","email":"daniel.mickael@gmail.com"},{"name":"samypesse","email":"samypesse@gmail.com"},{"name":"soreine","email":"soreine.plume@gmail.com"}],"contributors":[{"name":"Johan Preynat","email":"johan@gitbook.com"}],"homepage":"https://github.com/GitbookIO/mongoose-error","bugs":{"url":"https://github.com/GitbookIO/mongoose-error/issues"},"dist":{"shasum":"5ef2dbdb750a3b7371c03434cefd70d19cad90fc","tarball":"https://registry.npmjs.org/mongoose-error/-/mongoose-error-0.0.3.tgz","integrity":"sha512-0Do1grB4ljcTKzwmVKCZaru1MdLd5JFDyybt1Kc/AzRmctRE7m4TdHhJWHlnr7lzXAQU67Z1u5Q7HeqwOFoCnQ==","signatures":[{"sig":"MEUCIA0cb5OyGsiQ7ZXQBnxNSp0ciV6tQjpBk18jl167s6W+AiEA/AUgUHtBCPRTK1TsRktYl9wrlkCsadh3fbaXl5Frs9g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"5ef2dbdb750a3b7371c03434cefd70d19cad90fc","gitHead":"e8ac211249704d7c8fc9d64b2ccb00ea2bca1564","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"samypesse","email":"samypesse@gmail.com"},"repository":{"url":"git+https://github.com/GitbookIO/mongoose-error.git","type":"git"},"_npmVersion":"3.10.3","description":"Small Node.js utility to normalize and handle mongoose errors","directories":{},"_nodeVersion":"6.5.0","dependencies":{"http-errors":"^1.5.0","mongo-errors":"^1.0.1"},"devDependencies":{"eslint":"^3.4.0"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-error-0.0.3.tgz_1480970693819_0.6057222585659474","host":"packages-12-west.internal.npmjs.com"}},"1.0.0":{"name":"mongoose-error","version":"1.0.0","keywords":["mongoose","error"],"author":{"name":"GitBook Team","email":"contact@gitbook.com"},"license":"Apache-2.0","_id":"mongoose-error@1.0.0","maintainers":[{"name":"aarono","email":"aaron.omullan@gmail.com"},{"name":"gitbook-bot","email":"contact@gitbook.com"},{"name":"jpreynat","email":"johan.preynat@gmail.com"},{"name":"samypesse","email":"samypesse@gmail.com"},{"name":"soreine","email":"soreine.plume@gmail.com"}],"contributors":[{"name":"Johan Preynat","email":"johan@gitbook.com"}],"homepage":"https://github.com/GitbookIO/mongoose-error","bugs":{"url":"https://github.com/GitbookIO/mongoose-error/issues"},"dist":{"shasum":"1971a15d86d2248db4639abed2cf53c859df9a5b","tarball":"https://registry.npmjs.org/mongoose-error/-/mongoose-error-1.0.0.tgz","integrity":"sha512-Al4Rpb1GF10JGFT0ne4UTb12InvDwAU6hr5fMSv/9TJki1FA1HbZtI9VLx2akR5CK7Z9XETTO+B02GZcv+3erw==","signatures":[{"sig":"MEYCIQDRF7xWFSGw7SzA0kz+ga3cHrzLeSaJINI02+qQldfsBgIhAIFHBAz/39s1WmOGBZkV2KcbVZiIPdiXOw7QbVTMkHj8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"1971a15d86d2248db4639abed2cf53c859df9a5b","gitHead":"e59e70f753f62fc3e1a5e2aa810573ad56cf1114","scripts":{"test":"mocha ./test.js"},"_npmUser":{"name":"samypesse","email":"samypesse@gmail.com"},"repository":{"url":"git+https://github.com/GitbookIO/mongoose-error.git","type":"git"},"_npmVersion":"3.10.10","description":"Small Node.js utility to normalize and handle mongoose errors","directories":{},"_nodeVersion":"7.3.0","dependencies":{"http-errors":"^1.5.0","mongo-errors":"^1.0.1"},"devDependencies":{"mocha":"^3.2.0","eslint":"^3.4.0","expect":"^1.20.2","mongoose":"^4.8.1","eslint-config-gitbook":"^1.5.0"},"peerDependencies":{"mongoose":"*"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-error-1.0.0.tgz_1486379345249_0.07326730503700674","host":"packages-12-west.internal.npmjs.com"}},"1.0.1":{"name":"mongoose-error","version":"1.0.1","keywords":["mongoose","error"],"author":{"name":"GitBook Team","email":"contact@gitbook.com"},"license":"Apache-2.0","_id":"mongoose-error@1.0.1","maintainers":[{"name":"aarono","email":"aaron.omullan@gmail.com"},{"name":"gitbook-bot","email":"contact@gitbook.com"},{"name":"jpreynat","email":"johan.preynat@gmail.com"},{"name":"samypesse","email":"samypesse@gmail.com"},{"name":"soreine","email":"soreine.plume@gmail.com"}],"contributors":[{"name":"Johan Preynat","email":"johan@gitbook.com"}],"homepage":"https://github.com/GitbookIO/mongoose-error","bugs":{"url":"https://github.com/GitbookIO/mongoose-error/issues"},"dist":{"shasum":"d5b17313665c08a42ddf2ada3092f67daadf446e","tarball":"https://registry.npmjs.org/mongoose-error/-/mongoose-error-1.0.1.tgz","integrity":"sha512-0glbi67UMkig71AVgPCfyF+C7qeLhlhP2eDc41WlH5+/EnK+0JV68sd2eAXxSFjS5AcDp302yzRlhS/XV9cOGg==","signatures":[{"sig":"MEYCIQC4Em8H/z1PVUf2PPqAfao5oI13GUKftAar0K2rtcTuiwIhAMruwMKesHjRa/U95Qy2/wvH2yD3s8jvU5Sd8kOzXZa9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"d5b17313665c08a42ddf2ada3092f67daadf446e","gitHead":"ca209fd9a18f2ecf86ef10cef1abeeb15dac64cb","scripts":{"test":"mocha ./test.js"},"_npmUser":{"name":"samypesse","email":"samypesse@gmail.com"},"repository":{"url":"git+https://github.com/GitbookIO/mongoose-error.git","type":"git"},"_npmVersion":"3.10.10","description":"Small Node.js utility to normalize and handle mongoose errors","directories":{},"_nodeVersion":"7.3.0","dependencies":{"http-errors":"^1.5.0","mongo-errors":"^1.0.1"},"devDependencies":{"mocha":"^3.2.0","eslint":"^3.4.0","expect":"^1.20.2","mongoose":"^4.8.1","mongodb-core":"^2.1.7","eslint-config-gitbook":"^1.5.0"},"peerDependencies":{"mongoose":"*","mongodb-core":"*"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-error-1.0.1.tgz_1486498289732_0.857873699394986","host":"packages-18-east.internal.npmjs.com"}}},"time":{"created":"2016-08-31T13:24:13.145Z","modified":"2026-03-31T14:01:12.598Z","0.0.1":"2016-08-31T13:24:13.145Z","0.0.2":"2016-08-31T15:20:28.468Z","0.0.3":"2016-12-05T20:44:55.559Z","1.0.0":"2017-02-06T11:09:07.232Z","1.0.1":"2017-02-07T20:11:30.329Z"},"bugs":{"url":"https://github.com/GitbookIO/mongoose-error/issues"},"author":{"name":"GitBook Team","email":"contact@gitbook.com"},"license":"Apache-2.0","homepage":"https://github.com/GitbookIO/mongoose-error","keywords":["mongoose","error"],"repository":{"url":"git+https://github.com/GitbookIO/mongoose-error.git","type":"git"},"description":"Small Node.js utility to normalize and handle mongoose errors","contributors":[{"name":"Johan Preynat","email":"johan@gitbook.com"}],"maintainers":[{"email":"contact@gitbook.com","name":"gitbook-bot"},{"email":"samypesse@gmail.com","name":"samypesse"},{"email":"johan.preynat@gmail.com","name":"jpreynat"},{"email":"shne24@gmail.com","name":"emmerich"},{"email":"taranvohra@outlook.com","name":"taranvohra"},{"email":"nolann.biron@ynov.com","name":"nolannb"},{"email":"berge.greg@gmail.com","name":"neoziro"},{"email":"admin@zeno.zone","name":"zenoachtig"}],"readme":"# mongoose-error\n\n[![NPM version](https://badge.fury.io/js/mongoose-error.svg)](http://badge.fury.io/js/mongoose-error)\n[![Linux Build Status](https://travis-ci.org/GitbookIO/mongoose-error.svg?branch=master)](https://travis-ci.org/GitbookIO/mongoose-error)\n\nSmall Node.js utility to normalize mongoose errors.\n\n### Installation\n\n```\n$ npm install mongoose-error --save\n```\n\n### Usage\n\n`mongoose-error` normalize the error message to include the first validation error, and can also catch mongo duplicate key.\n\n```js\nconst mongooseError = require('mongoose-error');\n\nuser.save()\n.then(\n    () => {\n        console.log('saved!');\n    },\n    (err) => {\n        throw mongooseError(err, {\n            DuplicateKey: 'An user with this username already exist'\n        });\n    }\n);\n```\n","readmeFilename":"README.md"}