{"_id":"error-provider","_rev":"20-5e8c03a7c50440438215f89d8401271a","name":"error-provider","description":"Manages errors for third-party modules","dist-tags":{"latest":"0.0.6"},"versions":{"0.0.2":{"name":"error-provider","version":"0.0.2","description":"Manages errors for third-party modules","keywords":["error","errno","provider","libuv"],"author":{"name":"Gabriel Llamas","email":"gaglekas@gmail.com"},"repository":{"type":"git","url":"git://github.com/Gagle/Node-ErrorProvider.git"},"engines":{"node":"*"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/mit-license.html"}],"main":"lib/error-provider","readme":"error-provider\r\n==============\r\n\r\n_Node.js project_\r\n\r\n#### Manages errors for third-party modules ####\r\n\r\nVersion: 0.0.2\r\n\r\nWhen you're writing a third-party module you'll probably deal with errors. If you want to send custom errors to your users you should send a code and then in your documentation explain these codes.\r\n\r\nThis module eases the error management, you only need to give a number, a code and a description and when you need them just get and throw them.\r\n\r\nThe built-in errors are also available so if you need to manually throw a `EEXIST` you can do so.\r\n\r\nThe error description accepts variables, that is, you can create an error with a variable and when you get it you can set the variable value:\r\n\r\n```javascript\r\nep.create (1000, \"MY_CUSTOM_ERROR\", \"This is a {which} error\");\r\nconsole.log (ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: MY_CUSTOM_ERROR]\r\n  errno: 1000,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  description: \"This is a custom error\" }\r\n*/\r\n```\r\n\r\nIf you want to add another property different from `errno`, `code` and `description` you can do it, just pass an object with the new properties (if the property value is a string it can also have variables):\r\n\r\n```javascript\r\nep.create (ep.next (), \"MY_CUSTOM_ERROR\", \"This is a {which} error\", {\r\n\tpath: \"{path}\",\r\n\tfn: function (){\r\n\t\tconsole.log (\"custom error\");\r\n\t}\r\n});\r\nvar error = ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\", path: \"some/path\" });\r\nerror.fn ();\r\nconsole.log (error);\r\n\r\n/*\r\nPrints:\r\n\r\ncustom error\r\n{ [Error: MY_CUSTOM_ERROR]\r\n  errno: 100,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  description: \"This is a custom error\",\r\n  path: \"some/path\",\r\n  fn: [Function] }\r\n*/\r\n```\r\n\r\n#### Installation ####\r\n\r\n```\r\nnpm install error-provider\r\n```\r\n\r\n#### Example ####\r\n\r\n```javascript\r\nvar ep = require (\"error-provider\");\r\n\r\nconsole.log (ep.get (ep.ENOENT));\r\n\r\nvar n = ep.next ();\r\nep.create (n, \"TEST1\", \"test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (n));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: ENOENT]\r\n  errno: 34,\r\n  code: \"ENOENT\",\r\n  description: \"no such file or directory\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n*/\r\n```\r\n\r\n#### Methods ####\r\n\r\n- [ep.create(errno, code, description[, properties])](#create)\r\n- [ep.get(id[, vars])](#get)\r\n- [ep.next()](#next)\r\n\r\n<a name=\"create\"></a>\r\n__ep.create(errno, code, description[, properties])__  \r\nCreates an error with an id, code, description and additional properties.\r\n\r\nThe strings can contain variables that can be set later. A variable is a name encapsulated inside curly braces:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\", {\r\n\tpath: \"{p}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { p: \"some/path\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: TEST1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  description: \"Test 1\",\r\n  path: \"some/path\" }\r\n*/\r\n```\r\n\r\n<a name=\"get\"></a>\r\n__ep.get(id[, vars])__  \r\nReturns an error. It can be a Node.js built-in error such as `ENOENT` or one that was created previously.\r\n\r\nThe `id` can be a Number, String or Object:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (100));\r\n```\r\n\r\nIf `vars` is provided, the variables found in the error properties that are String will be set with the given value.\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test {number}\", {\r\n\tn: \"{number}\",\r\n\tp: \"{value}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { number: 1, value: \"ok\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: TEST1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  description: \"Test 1\",\r\n  n: \"1\",\r\n  p: \"ok\" }\r\n*/\r\n```\r\n\r\n<a name=\"next\"></a>\r\n__ep.next()__  \r\nReturns the next available error number and increments the counter. This number is an identifier to create errors.\r\n\r\nThe first available number starts at 100.\r\n\r\nThe following example creates three errors with identified with 100, 101 and 102.\r\n\r\n```javascript\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\n```","readmeFilename":"README.md","_id":"error-provider@0.0.2","dist":{"shasum":"91ae97ed1436abcff2fe10e83b9c36fa9268e50b","tarball":"https://registry.npmjs.org/error-provider/-/error-provider-0.0.2.tgz","integrity":"sha512-Q2tdV+kSVdH6QgdtajFwtdjXOBXX+lD0rBIcbm0vojAxnnNRHNLatiaJiLOsv5OOk/bpjXd+xPHaVcYTcBbCww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD/EAqGWwL0QbZWv32FnJbXiL2Na2I40yM112K845T75gIhAJ2SMQmUQ0gFQKDhjuAJKrlWlQXwjW9ibSk2uZeV6Mzi"}]},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"Gagle","email":"gaglekas@gmail.com"},"maintainers":[{"name":"Gagle","email":"gaglekas@gmail.com"}],"directories":{},"deprecated":"deprecated"},"0.0.3":{"name":"error-provider","version":"0.0.3","description":"Manages errors for third-party modules","keywords":["error","errno","provider","libuv"],"author":{"name":"Gabriel Llamas","email":"gaglekas@gmail.com"},"repository":{"type":"git","url":"git://github.com/Gagle/Node-ErrorProvider.git"},"engines":{"node":"*"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/mit-license.html"}],"main":"lib/error-provider","readme":"error-provider\r\n==============\r\n\r\n_Node.js project_\r\n\r\n#### Manages errors for third-party modules ####\r\n\r\nVersion: 0.0.3\r\n\r\nWhen you're writing a third-party module you'll probably deal with errors. If you want to send custom errors to your users you should send a code and then in your documentation explain these codes.\r\n\r\nThis module eases the error management, you only need to give a number, a code and a description and when you need them just get and throw them.\r\n\r\nThe built-in errors are also available so if you need to manually throw a `EEXIST` you can do so.\r\n\r\nThe error description accepts variables, that is, you can create an error with a variable and when you get it you can set the variable value:\r\n\r\n```javascript\r\nep.create (1000, \"MY_CUSTOM_ERROR\", \"This is a {which} error\");\r\nconsole.log (ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: MY_CUSTOM_ERROR]\r\n  errno: 1000,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  description: \"This is a custom error\" }\r\n*/\r\n```\r\n\r\nIf you want to add another property different from `errno`, `code` and `description` you can do it, just pass an object with the new properties (if the property value is a string it can also have variables):\r\n\r\n```javascript\r\nep.create (ep.next (), \"MY_CUSTOM_ERROR\", \"This is a {which} error\", {\r\n\tpath: \"{path}\",\r\n\tfn: function (){\r\n\t\tconsole.log (\"custom error\");\r\n\t}\r\n});\r\nvar error = ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\", path: \"some/path\" });\r\nerror.fn ();\r\nconsole.log (error);\r\n\r\n/*\r\nPrints:\r\n\r\ncustom error\r\n{ [Error: MY_CUSTOM_ERROR]\r\n  errno: 100,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  description: \"This is a custom error\",\r\n  path: \"some/path\",\r\n  fn: [Function] }\r\n*/\r\n```\r\n\r\n#### Installation ####\r\n\r\n```\r\nnpm install error-provider\r\n```\r\n\r\n#### Example ####\r\n\r\n```javascript\r\nvar ep = require (\"error-provider\");\r\n\r\nconsole.log (ep.get (ep.ENOENT));\r\n\r\nvar n = ep.next ();\r\nep.create (n, \"TEST1\", \"test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (n));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: ENOENT]\r\n  errno: 34,\r\n  code: \"ENOENT\",\r\n  description: \"no such file or directory\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n*/\r\n```\r\n\r\n#### Methods ####\r\n\r\nThere's a special method called `local()` that returns a local error provider. If you need a local storage with custom errors that you don't need to make public, `local()` can help you. If another third-party module uses the `error-provider` module you won't see its errors, the local error provider is local to your module. The first available errno is 0 and the set of default codes is empty, that is, you can't return a built-in error like `EEXIST`. You can create all the storages you want.\r\n\r\n```javascript\r\nvar ep = require (\"error-provider\").local ();\r\nep.create (ep.next (), ...);\r\nep.get (...);\r\n```\r\n\r\n- [ep.create(errno, code, description[, properties])](#create)\r\n- [ep.get(id[, vars])](#get)\r\n- [ep.next()](#next)\r\n\r\n<a name=\"create\"></a>\r\n__ep.create(errno, code, description[, properties])__  \r\nCreates an error with an id, code, description and additional properties.\r\n\r\nThe strings can contain variables that can be set later. A variable is a name encapsulated inside curly braces:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\", {\r\n\tpath: \"{p}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { p: \"some/path\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: TEST1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  description: \"Test 1\",\r\n  path: \"some/path\" }\r\n*/\r\n```\r\n\r\n<a name=\"get\"></a>\r\n__ep.get(id[, vars])__  \r\nReturns an error. It can be a Node.js built-in error such as `ENOENT` or one that was created previously.\r\n\r\nThe `id` can be a Number, String or Object:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (100));\r\n```\r\n\r\nIf `vars` is provided, the variables found in the error properties that are String will be set with the given value.\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test {number}\", {\r\n\tn: \"{number}\",\r\n\tp: \"{value}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { number: 1, value: \"ok\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: TEST1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  description: \"Test 1\",\r\n  n: \"1\",\r\n  p: \"ok\" }\r\n*/\r\n```\r\n\r\n<a name=\"next\"></a>\r\n__ep.next()__  \r\nReturns the next available error number and increments the counter. This number is an identifier to create errors.\r\n\r\nThe first available number starts at 100.\r\n\r\nThe following example creates three errors with identified with 100, 101 and 102.\r\n\r\n```javascript\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\n```","readmeFilename":"README.md","_id":"error-provider@0.0.3","dist":{"shasum":"dbbb0e66095b38b15db6e05f3dec8e1bf52624b4","tarball":"https://registry.npmjs.org/error-provider/-/error-provider-0.0.3.tgz","integrity":"sha512-Y/oUu4G98AA3Vgcwr8r0bkjcuu6y5iwER4LxEBish3RhYMB5IcWOeU0h1Boiagc3+9R26HKZALdO0CWEki4zug==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFqyWcGy2+4m13Q8ulimhVFBpinlTunc5RJ5GdCUIeAZAiEAnWXbTd4+VltOnkC9iddT+sGbOjrG6yXKePL/BC/yXqc="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"Gagle","email":"gaglekas@gmail.com"},"maintainers":[{"name":"Gagle","email":"gaglekas@gmail.com"}],"directories":{},"deprecated":"deprecated"},"0.0.4":{"name":"error-provider","version":"0.0.4","description":"Manages errors for third-party modules","keywords":["error","errno","provider","libuv"],"author":{"name":"Gabriel Llamas","email":"gaglekas@gmail.com"},"repository":{"type":"git","url":"git://github.com/Gagle/Node-ErrorProvider.git"},"engines":{"node":"*"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/mit-license.html"}],"main":"lib/error-provider","readme":"error-provider\r\n==============\r\n\r\n_Node.js project_\r\n\r\n#### Manages errors for third-party modules ####\r\n\r\nVersion: 0.0.4\r\n\r\nWhen you're writing a third-party module you'll probably deal with errors. If you want to send custom errors to your users you should send a code and then in your documentation explain these codes.\r\n\r\nThis module eases the error management, you only need to give a number, a code and a description and when you need them just get and throw them.\r\n\r\nThe built-in errors are also available so if you need to manually throw a `EEXIST` you can do so.\r\n\r\nThe error description accepts variables, that is, you can create an error with a variable and when you get it you can set the variable value:\r\n\r\n```javascript\r\nep.create (1000, \"MY_CUSTOM_ERROR\", \"This is a {which} error\");\r\nconsole.log (ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: MY_CUSTOM_ERROR]\r\n  errno: 1000,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  description: \"This is a custom error\" }\r\n*/\r\n```\r\n\r\nIf you want to add another property different from `errno`, `code` and `description` you can do it, just pass an object with the new properties (if the property value is a string it can also have variables):\r\n\r\n```javascript\r\nep.create (ep.next (), \"MY_CUSTOM_ERROR\", \"This is a {which} error\", {\r\n\tpath: \"{path}\",\r\n\tfn: function (){\r\n\t\tconsole.log (\"custom error\");\r\n\t}\r\n});\r\nvar error = ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\", path: \"some/path\" });\r\nerror.fn ();\r\nconsole.log (error);\r\n\r\n/*\r\nPrints:\r\n\r\ncustom error\r\n{ [Error: MY_CUSTOM_ERROR]\r\n  errno: 100,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  description: \"This is a custom error\",\r\n  path: \"some/path\",\r\n  fn: [Function] }\r\n*/\r\n```\r\n\r\n#### Installation ####\r\n\r\n```\r\nnpm install error-provider\r\n```\r\n\r\n#### Example ####\r\n\r\n```javascript\r\nvar ep = require (\"error-provider\");\r\n\r\nconsole.log (ep.get (ep.ENOENT));\r\n\r\nvar n = ep.next ();\r\nep.create (n, \"TEST1\", \"test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (n));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: ENOENT]\r\n  errno: 34,\r\n  code: \"ENOENT\",\r\n  description: \"no such file or directory\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n*/\r\n```\r\n\r\n#### Methods ####\r\n\r\nThere's a special method called `local()` that returns a local error provider. If you need a local storage with custom errors that you don't need to make public, `local()` can help you. If another third-party module uses the `error-provider` module you won't see its errors, the local error provider is local to your module. The first available errno is 0 and the set of default codes is empty, that is, you can't return a built-in error like `EEXIST`. You can create all the storages you want.\r\n\r\n```javascript\r\nvar ep = require (\"error-provider\").local ();\r\nep.create (ep.next (), ...);\r\nep.get (...);\r\n```\r\n\r\n- [ep.create(errno, code, description[, properties])](#create)\r\n- [ep.get(id[, vars])](#get)\r\n- [ep.next()](#next)\r\n\r\n<a name=\"create\"></a>\r\n__ep.create(errno, code, description[, properties])__  \r\nCreates an error with an id, code, description and additional properties.\r\n\r\nThe strings can contain variables that can be set later. A variable is a name encapsulated inside curly braces:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\", {\r\n\tpath: \"{p}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { p: \"some/path\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: TEST1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  description: \"Test 1\",\r\n  path: \"some/path\" }\r\n*/\r\n```\r\n\r\n<a name=\"get\"></a>\r\n__ep.get(id[, vars])__  \r\nReturns an error. It can be a Node.js built-in error such as `ENOENT` or one that was created previously.\r\n\r\nThe `id` can be a Number, String or Object:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (100));\r\n```\r\n\r\nIf `vars` is provided, the variables found in the error properties that are String will be set with the given value.\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test {number}\", {\r\n\tn: \"{number}\",\r\n\tp: \"{value}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { number: 1, value: \"ok\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: TEST1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  description: \"Test 1\",\r\n  n: \"1\",\r\n  p: \"ok\" }\r\n*/\r\n```\r\n\r\n<a name=\"next\"></a>\r\n__ep.next()__  \r\nReturns the next available error number and increments the counter. This number is an identifier to create errors.\r\n\r\nThe first available number starts at 100.\r\n\r\nThe following example creates three errors with identified with 100, 101 and 102.\r\n\r\n```javascript\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\n```","readmeFilename":"README.md","_id":"error-provider@0.0.4","dist":{"shasum":"8d89495aeca7436fbd33f462e6c32f886453f28c","tarball":"https://registry.npmjs.org/error-provider/-/error-provider-0.0.4.tgz","integrity":"sha512-cQGpeUjjuyNcyQ/eDC4PsF8f93FbEn//BNrvuVdNhVhnnXh1xp9g00DfG48C3md6bVre34tDY1YpIahgVH5D4g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICUq7mydmwMqGx/HvlejRPNgUwdGhWwquh/eRkzI3RC+AiBnH6AwYqZtcIQvs2zTrPEsxHJEL7n8qF7p0M68Ca5cVQ=="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"Gagle","email":"gaglekas@gmail.com"},"maintainers":[{"name":"Gagle","email":"gaglekas@gmail.com"}],"directories":{},"deprecated":"deprecated"},"0.0.5":{"name":"error-provider","version":"0.0.5","description":"Manages errors for third-party modules","keywords":["error","errno","provider","libuv"],"author":{"name":"Gabriel Llamas","email":"gaglekas@gmail.com"},"repository":{"type":"git","url":"git://github.com/Gagle/Node-ErrorProvider.git"},"engines":{"node":"*"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/mit-license.html"}],"main":"lib/error-provider","readme":"error-provider\r\n==============\r\n\r\n_Node.js project_\r\n\r\n#### Manages errors for third-party modules ####\r\n\r\nVersion: 0.0.5\r\n\r\nWhen you're writing a third-party module you'll probably deal with errors. If you want to send custom errors to your users you should send a code and then in your documentation explain these codes.\r\n\r\nThis module eases the error management, you only need to give a number, a code and a description and when you need them just get and throw them.\r\n\r\nThe built-in errors are also available so if you need to manually throw a `EEXIST` you can do so.\r\n\r\nThe error description accepts variables, that is, you can create an error with a variable and when you get it you can set the variable value:\r\n\r\n```javascript\r\nep.create (1000, \"MY_CUSTOM_ERROR\", \"This is a {which} error\");\r\nconsole.log (ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: MY_CUSTOM_ERROR]\r\n  errno: 1000,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  description: \"This is a custom error\" }\r\n*/\r\n```\r\n\r\nIf you want to add another property different from `errno`, `code` and `description` you can do it, just pass an object with the new properties (if the property value is a string it can also have variables):\r\n\r\n```javascript\r\nep.create (ep.next (), \"MY_CUSTOM_ERROR\", \"This is a {which} error\", {\r\n\tpath: \"{path}\",\r\n\tfn: function (){\r\n\t\tconsole.log (\"custom error\");\r\n\t}\r\n});\r\nvar error = ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\", path: \"some/path\" });\r\nerror.fn ();\r\nconsole.log (error);\r\n\r\n/*\r\nPrints:\r\n\r\ncustom error\r\n{ [Error: MY_CUSTOM_ERROR]\r\n  errno: 100,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  description: \"This is a custom error\",\r\n  path: \"some/path\",\r\n  fn: [Function] }\r\n*/\r\n```\r\n\r\n#### Installation ####\r\n\r\n```\r\nnpm install error-provider\r\n```\r\n\r\n#### Example ####\r\n\r\n```javascript\r\nvar ep = require (\"error-provider\");\r\n\r\nconsole.log (ep.get (ep.ENOENT));\r\n\r\nvar n = ep.next ();\r\nep.create (n, \"TEST1\", \"test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (n));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: ENOENT]\r\n  errno: 34,\r\n  code: \"ENOENT\",\r\n  description: \"no such file or directory\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n*/\r\n```\r\n\r\n#### Methods ####\r\n\r\nThere's a special method called `local()` that returns a local error provider. If you need a local storage with custom errors that you don't need to make public, `local()` can help you. If another third-party module uses the `error-provider` module you won't see its errors, the local error provider is local to your module. The first available errno is 0 and the set of default codes is empty, that is, you can't return a built-in error like `EEXIST`. You can create all the storages you want.\r\n\r\n```javascript\r\nvar ep = require (\"error-provider\").local ();\r\nep.create (ep.next (), ...);\r\nep.get (...);\r\n```\r\n\r\n- [ep.create(errno, code, description[, properties])](#create)\r\n- [ep.get(id[, vars])](#get)\r\n- [ep.next()](#next)\r\n\r\n<a name=\"create\"></a>\r\n__ep.create(errno, code, description[, properties])__  \r\nCreates an error with an id, code, description and additional properties.\r\n\r\nThe strings can contain variables that can be set later. A variable is a name encapsulated inside curly braces:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\", {\r\n\tpath: \"{p}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { p: \"some/path\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: TEST1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  description: \"Test 1\",\r\n  path: \"some/path\" }\r\n*/\r\n```\r\n\r\n<a name=\"get\"></a>\r\n__ep.get(id[, vars])__  \r\nReturns an error. It can be a Node.js built-in error such as `ENOENT` or one that was created previously.\r\n\r\nThe `id` can be a Number, String or Object:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (100));\r\n```\r\n\r\nIf `vars` is provided, the variables found in the error properties that are String will be set with the given value.\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test {number}\", {\r\n\tn: \"{number}\",\r\n\tp: \"{value}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { number: 1, value: \"ok\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: TEST1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  description: \"Test 1\",\r\n  n: \"1\",\r\n  p: \"ok\" }\r\n*/\r\n```\r\n\r\n<a name=\"next\"></a>\r\n__ep.next()__  \r\nReturns the next available error number and increments the counter. This number is an identifier to create errors.\r\n\r\nThe first available number starts at 100.\r\n\r\nThe following example creates three errors with identified with 100, 101 and 102.\r\n\r\n```javascript\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\n```","readmeFilename":"README.md","_id":"error-provider@0.0.5","dist":{"shasum":"71941074610f4f98ac6c879c2524b374e044eb97","tarball":"https://registry.npmjs.org/error-provider/-/error-provider-0.0.5.tgz","integrity":"sha512-6SlZgsiYiVGMSnmEjA6+YybwYd4dHKpgEsWfrt64VkMP0jR/GO8dvp8dtQFiAy68lG/FCfzNKxLlpyb5HofbYg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjXmJPat1EL9JxY/XfYN+7lLbYYp31c4aexcb/uKcc6wIgE+K98lMEMdRqR4mQYfpXAJBJSroeNNDNN5GLq83SaCI="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"Gagle","email":"gaglekas@gmail.com"},"maintainers":[{"name":"Gagle","email":"gaglekas@gmail.com"}],"directories":{},"deprecated":"deprecated"},"0.0.6":{"name":"error-provider","version":"0.0.6","description":"Manages errors for third-party modules","keywords":["error","errno","provider","libuv"],"author":{"name":"Gabriel Llamas","email":"gaglekas@gmail.com"},"repository":{"type":"git","url":"git://github.com/Gagle/Node-ErrorProvider.git"},"engines":{"node":"*"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/mit-license.html"}],"main":"lib/error-provider","readme":"error-provider\r\n==============\r\n\r\n_Node.js project_\r\n\r\n#### Manages errors for third-party modules ####\r\n\r\nVersion: 0.0.6\r\n\r\nWhen you're writing a third-party module you'll probably deal with errors. If you want to send custom errors to your users you should send a code and then in your documentation explain these codes.\r\n\r\nThis module eases the error management, you only need to give a number, a code and a description and when you need them just get and throw them.\r\n\r\nThe built-in errors are also available so if you need to manually throw a `EEXIST` you can do so.\r\n\r\nThe error description accepts variables, that is, you can create an error with a variable and when you get it you can set the variable value:\r\n\r\n```javascript\r\nep.create (1000, \"MY_CUSTOM_ERROR\", \"This is a {which} error\");\r\nconsole.log (ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [MY_CUSTOM_ERROR: This is a custom error] errno: 1000, code: \"MY_CUSTOM_ERROR\" }\r\n*/\r\n```\r\n\r\nIf you want to add another property different from `errno`, `code` and `description` you can do it, just pass an object with the new properties (if the property value is a string it can also have variables):\r\n\r\n```javascript\r\nep.create (ep.next (), \"MY_CUSTOM_ERROR\", \"This is a {which} error\", {\r\n\tpath: \"{path}\",\r\n\tfn: function (){\r\n\t\tconsole.log (\"custom error\");\r\n\t}\r\n});\r\nvar error = ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\", path: \"some/path\" });\r\nerror.fn ();\r\nconsole.log (error);\r\n\r\n/*\r\nPrints:\r\n\r\ncustom error\r\n{ [MY_CUSTOM_ERROR: This is a custom error]\r\n  errno: 100,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  path: \"some/path\",\r\n  fn: [Function] }\r\n*/\r\n```\r\n\r\n#### Installation ####\r\n\r\n```\r\nnpm install error-provider\r\n```\r\n\r\n#### Example ####\r\n\r\n```javascript\r\nvar ep = require (\"error-provider\");\r\n\r\nconsole.log (ep.get (ep.ENOENT));\r\n\r\nvar n = ep.next ();\r\nep.create (n, \"TEST1\", \"test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (n));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [ENOENT: no such file or directory] errno: 34, code: \"ENOENT\" }\r\n{ [TEST1: test 1] errno: 100, code: \"TEST1\" }\r\n{ [TEST1: test 1] errno: 100, code: \"TEST1\" }\r\n{ [TEST1: test 1] errno: 100, code: \"TEST1\" }\r\n*/\r\n```\r\n\r\n#### Methods ####\r\n\r\nThere's a special method called `local()` that returns a local error provider. If you need a local storage with custom errors that you don't need to make public, `local()` can help you. If another third-party module uses the `error-provider` module you won't see its errors, the local error provider is local to your module. The first available errno is 0 and the set of default codes is empty, that is, you can't return a built-in error like `EEXIST`. You can create all the storages you want.\r\n\r\n```javascript\r\nvar ep = require (\"error-provider\").local ();\r\nep.create (ep.next (), ...);\r\nep.get (...);\r\n```\r\n\r\n- [ep.create(errno, code, description[, properties])](#create)\r\n- [ep.get(id[, vars])](#get)\r\n- [ep.next()](#next)\r\n\r\n<a name=\"create\"></a>\r\n__ep.create(errno, code, description[, properties])__  \r\nCreates an error with an id, code, description and additional properties.\r\n\r\nThe strings can contain variables that can be set later. A variable is a name encapsulated inside curly braces:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"test 1\", {\r\n\tpath: \"{p}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { p: \"some/path\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [TEST1: test 1] errno: 100, code: \"TEST1\", path: \"some/path\" }\r\n*/\r\n```\r\n\r\n<a name=\"get\"></a>\r\n__ep.get(id[, vars])__  \r\nReturns an error. It can be a Node.js built-in error such as `ENOENT` or one that was created previously.\r\n\r\nThe `id` can be a Number, String or Object:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (100));\r\n```\r\n\r\nIf `vars` is provided, the variables found in the error properties that are String will be set with the given value.\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"test {number}\", {\r\n\tn: \"{number}\",\r\n\tp: \"{value}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { number: 1, value: \"ok\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [TEST1: test 1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  n: \"1\",\r\n  p: \"ok\" }\r\n*/\r\n```\r\n\r\n<a name=\"next\"></a>\r\n__ep.next()__  \r\nReturns the next available error number and increments the counter. This number is an identifier to create errors.\r\n\r\nThe first available number starts at 100.\r\n\r\nThe following example creates three errors with identified with 100, 101 and 102.\r\n\r\n```javascript\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\n```","readmeFilename":"README.md","_id":"error-provider@0.0.6","dist":{"shasum":"37936c7a76c86afaec74af0f2542b9f5bee306b0","tarball":"https://registry.npmjs.org/error-provider/-/error-provider-0.0.6.tgz","integrity":"sha512-7GDW+LZR01avkedoWHyIaPbJ3BcWBoYaTJWLy0d/Sp1Bo0spLGKRDtoijJnKHiYh+/vOkj9sTX21piduiqZT1w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHNbCuhlBCNjG/wDI4WXJ7z/peIER2jlFl9z0kgTTWyBAiEAoIC5BSMzI1mo6YR1OKJgKoLUldOrIhk8zSQ4LzeoXp8="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"Gagle","email":"gaglekas@gmail.com"},"maintainers":[{"name":"Gagle","email":"gaglekas@gmail.com"}],"directories":{},"deprecated":"deprecated"}},"readme":"error-provider\r\n==============\r\n\r\n_Node.js project_\r\n\r\n#### Manages errors for third-party modules ####\r\n\r\nVersion: 0.0.2\r\n\r\nWhen you're writing a third-party module you'll probably deal with errors. If you want to send custom errors to your users you should send a code and then in your documentation explain these codes.\r\n\r\nThis module eases the error management, you only need to give a number, a code and a description and when you need them just get and throw them.\r\n\r\nThe built-in errors are also available so if you need to manually throw a `EEXIST` you can do so.\r\n\r\nThe error description accepts variables, that is, you can create an error with a variable and when you get it you can set the variable value:\r\n\r\n```javascript\r\nep.create (1000, \"MY_CUSTOM_ERROR\", \"This is a {which} error\");\r\nconsole.log (ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: MY_CUSTOM_ERROR]\r\n  errno: 1000,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  description: \"This is a custom error\" }\r\n*/\r\n```\r\n\r\nIf you want to add another property different from `errno`, `code` and `description` you can do it, just pass an object with the new properties (if the property value is a string it can also have variables):\r\n\r\n```javascript\r\nep.create (ep.next (), \"MY_CUSTOM_ERROR\", \"This is a {which} error\", {\r\n\tpath: \"{path}\",\r\n\tfn: function (){\r\n\t\tconsole.log (\"custom error\");\r\n\t}\r\n});\r\nvar error = ep.get (\"MY_CUSTOM_ERROR\", { which: \"custom\", path: \"some/path\" });\r\nerror.fn ();\r\nconsole.log (error);\r\n\r\n/*\r\nPrints:\r\n\r\ncustom error\r\n{ [Error: MY_CUSTOM_ERROR]\r\n  errno: 100,\r\n  code: \"MY_CUSTOM_ERROR\",\r\n  description: \"This is a custom error\",\r\n  path: \"some/path\",\r\n  fn: [Function] }\r\n*/\r\n```\r\n\r\n#### Installation ####\r\n\r\n```\r\nnpm install error-provider\r\n```\r\n\r\n#### Example ####\r\n\r\n```javascript\r\nvar ep = require (\"error-provider\");\r\n\r\nconsole.log (ep.get (ep.ENOENT));\r\n\r\nvar n = ep.next ();\r\nep.create (n, \"TEST1\", \"test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (n));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: ENOENT]\r\n  errno: 34,\r\n  code: \"ENOENT\",\r\n  description: \"no such file or directory\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n{ [Error: TEST1] errno: 100, code: \"TEST1\", description: \"test 1\" }\r\n*/\r\n```\r\n\r\n#### Methods ####\r\n\r\n- [ep.create(errno, code, description[, properties])](#create)\r\n- [ep.get(id[, vars])](#get)\r\n- [ep.next()](#next)\r\n\r\n<a name=\"create\"></a>\r\n__ep.create(errno, code, description[, properties])__  \r\nCreates an error with an id, code, description and additional properties.\r\n\r\nThe strings can contain variables that can be set later. A variable is a name encapsulated inside curly braces:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\", {\r\n\tpath: \"{p}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { p: \"some/path\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: TEST1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  description: \"Test 1\",\r\n  path: \"some/path\" }\r\n*/\r\n```\r\n\r\n<a name=\"get\"></a>\r\n__ep.get(id[, vars])__  \r\nReturns an error. It can be a Node.js built-in error such as `ENOENT` or one that was created previously.\r\n\r\nThe `id` can be a Number, String or Object:\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test 1\");\r\nconsole.log (ep.get (ep.TEST1));\r\nconsole.log (ep.get (\"TEST1\"));\r\nconsole.log (ep.get (100));\r\n```\r\n\r\nIf `vars` is provided, the variables found in the error properties that are String will be set with the given value.\r\n\r\n```javascript\r\nep.create (ep.next (), \"TEST1\", \"Test {number}\", {\r\n\tn: \"{number}\",\r\n\tp: \"{value}\"\r\n});\r\nconsole.log (ep.get (\"TEST1\", { number: 1, value: \"ok\" }));\r\n\r\n/*\r\nPrints:\r\n\r\n{ [Error: TEST1]\r\n  errno: 100,\r\n  code: \"TEST1\",\r\n  description: \"Test 1\",\r\n  n: \"1\",\r\n  p: \"ok\" }\r\n*/\r\n```\r\n\r\n<a name=\"next\"></a>\r\n__ep.next()__  \r\nReturns the next available error number and increments the counter. This number is an identifier to create errors.\r\n\r\nThe first available number starts at 100.\r\n\r\nThe following example creates three errors with identified with 100, 101 and 102.\r\n\r\n```javascript\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\nep.create (ep.next (), ...);\r\n```","maintainers":[{"name":"gagle","email":"gabriel_llamas_llopis@yahoo.es"}],"time":{"modified":"2022-06-17T08:20:45.265Z","created":"2013-01-20T17:18:59.008Z","0.0.2":"2013-01-20T17:19:03.455Z","0.0.3":"2013-02-27T18:28:44.677Z","0.0.4":"2013-03-01T07:54:08.168Z","0.0.5":"2013-03-05T12:12:17.916Z","0.0.6":"2013-03-10T00:17:57.063Z"},"author":{"name":"Gabriel Llamas","email":"gaglekas@gmail.com"},"repository":{"type":"git","url":"git://github.com/Gagle/Node-ErrorProvider.git"}}