{"_id":"eth-json-rpc-errors","_rev":"4629407","name":"eth-json-rpc-errors","description":"Ethereum JSON RPC and Provider errors.","dist-tags":{"latest":"2.0.2"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"time":{"modified":"2026-04-10T18:47:55.000Z","created":"2019-08-08T23:58:34.379Z","2.0.2":"2020-02-12T18:17:44.505Z","2.0.1":"2020-01-31T20:19:08.638Z","2.0.0":"2019-09-26T22:39:25.875Z","1.1.1":"2019-09-26T22:37:37.863Z","1.1.0":"2019-09-16T23:04:53.425Z","1.0.1":"2019-08-17T00:35:50.371Z","1.0.0":"2019-08-17T00:26:05.700Z","0.3.1":"2019-08-09T22:23:43.949Z","0.3.0":"2019-08-09T15:31:36.248Z","0.2.0":"2019-08-08T23:58:34.379Z"},"users":{},"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"versions":{"2.0.2":{"name":"eth-json-rpc-errors","version":"2.0.2","description":"Ethereum JSON RPC and Provider errors.","main":"index.js","scripts":{"test":"node test","test:coverage":"nyc tape test","lint":"eslint index.js","lint:fix":"eslint index.js --fix","prepare":"yarn lint:fix && yarn test"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"keywords":["json","rpc","ethereum","errors","utility"],"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","devDependencies":{"eslint":"^6.1.0","fast-deep-equal":"^2.0.1","nyc":"^14.1.1","tape":"^4.11.0"},"dependencies":{"fast-safe-stringify":"^2.0.6"},"gitHead":"352e65b8d85a5845696224faebfb80409179c287","_id":"eth-json-rpc-errors@2.0.2","_nodeVersion":"13.7.0","_npmVersion":"6.13.6","dist":{"shasum":"c1965de0301fe941c058e928bebaba2e1285e3c4","size":10059,"noattachment":false,"key":"/eth-json-rpc-errors/-/eth-json-rpc-errors-2.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/eth-json-rpc-errors/download/eth-json-rpc-errors-2.0.2.tgz"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"_npmUser":{"name":"rekmarks","email":"rekmarks@protonmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-json-rpc-errors_2.0.2_1581531464370_0.5726574181701685"},"_hasShrinkwrap":false,"publish_time":1581531464505,"deprecated":"Package renamed: https://www.npmjs.com/package/eth-rpc-errors","_cnpm_publish_time":1581531464505,"_cnpmcore_publish_time":"2021-12-16T15:32:41.802Z"},"2.0.1":{"name":"eth-json-rpc-errors","version":"2.0.1","description":"Ethereum JSON RPC and Provider errors.","main":"index.js","scripts":{"test":"node test","test:coverage":"nyc tape test","lint":"eslint index.js","lint:fix":"eslint index.js --fix","prepare":"yarn lint:fix && yarn test"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"keywords":["json","rpc","ethereum","errors","utility"],"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","devDependencies":{"eslint":"^6.1.0","fast-deep-equal":"^2.0.1","nyc":"^14.1.1","tape":"^4.11.0"},"dependencies":{"fast-safe-stringify":"^2.0.6"},"gitHead":"702e3420a1813a64d7cd75422d77b66a1d82bded","_id":"eth-json-rpc-errors@2.0.1","_nodeVersion":"13.2.0","_npmVersion":"6.13.1","dist":{"shasum":"e7a4c4e3c76913dff26dbc021966c72b2822e0f2","size":10069,"noattachment":false,"key":"/eth-json-rpc-errors/-/eth-json-rpc-errors-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/eth-json-rpc-errors/download/eth-json-rpc-errors-2.0.1.tgz"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"_npmUser":{"name":"rekmarks","email":"rekmarks@protonmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-json-rpc-errors_2.0.1_1580501948449_0.7245725315392182"},"_hasShrinkwrap":false,"publish_time":1580501948638,"deprecated":"Package renamed: https://www.npmjs.com/package/eth-rpc-errors","_cnpm_publish_time":1580501948638,"_cnpmcore_publish_time":"2021-12-16T15:32:42.053Z"},"2.0.0":{"name":"eth-json-rpc-errors","version":"2.0.0","description":"Ethereum JSON RPC and Provider errors.","main":"index.js","scripts":{"test":"node test","test:coverage":"nyc tape test","lint":"eslint index.js","lint:fix":"eslint index.js --fix","prepare":"npm run lint:fix && npm run test"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"keywords":["json","rpc","ethereum","errors","utility"],"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","devDependencies":{"eslint":"^6.1.0","fast-deep-equal":"^2.0.1","nyc":"^14.1.1","tape":"^4.11.0"},"dependencies":{"fast-safe-stringify":"^2.0.6"},"gitHead":"53d76f64903032b9f22d9a6da7ce849427fc3ee5","_id":"eth-json-rpc-errors@2.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"bdc19df8b80a820844709193372f0d75fb74fed8","size":9908,"noattachment":false,"key":"/eth-json-rpc-errors/-/eth-json-rpc-errors-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/eth-json-rpc-errors/download/eth-json-rpc-errors-2.0.0.tgz"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"_npmUser":{"name":"rekmarks","email":"rekmarks@protonmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-json-rpc-errors_2.0.0_1569537565719_0.8416859154986776"},"_hasShrinkwrap":false,"publish_time":1569537565875,"deprecated":"Package renamed: https://www.npmjs.com/package/eth-rpc-errors","_cnpm_publish_time":1569537565875,"_cnpmcore_publish_time":"2021-12-16T15:32:42.329Z"},"1.1.1":{"name":"eth-json-rpc-errors","version":"1.1.1","description":"Ethereum JSON RPC errors and standard JSON RPC 2.0 errors.","main":"index.js","scripts":{"test":"node test","lint":"eslint index.js","lint:fix":"eslint index.js --fix","prepare":"npm run lint:fix && npm run test"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"keywords":["json","rpc","ethereum","errors","utility"],"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","devDependencies":{"eslint":"^6.1.0","fast-deep-equal":"^2.0.1","tape":"^4.11.0"},"dependencies":{"fast-safe-stringify":"^2.0.6"},"gitHead":"bae5ad8aee6cebdc5a27136d970c58b0a86e3454","_id":"eth-json-rpc-errors@1.1.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"148377ef55155585981c21ff574a8937f9d6991f","size":8400,"noattachment":false,"key":"/eth-json-rpc-errors/-/eth-json-rpc-errors-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/eth-json-rpc-errors/download/eth-json-rpc-errors-1.1.1.tgz"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"_npmUser":{"name":"rekmarks","email":"rekmarks@protonmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-json-rpc-errors_1.1.1_1569537457731_0.8818951500541601"},"_hasShrinkwrap":false,"publish_time":1569537457863,"deprecated":"Package renamed: https://www.npmjs.com/package/eth-rpc-errors","_cnpm_publish_time":1569537457863,"_cnpmcore_publish_time":"2021-12-16T15:32:42.529Z"},"1.1.0":{"name":"eth-json-rpc-errors","version":"1.1.0","description":"Ethereum JSON RPC errors and standard JSON RPC 2.0 errors.","main":"index.js","scripts":{"test":"node test","lint":"eslint index.js","lint:fix":"eslint index.js --fix","prepare":"npm run lint:fix && npm run test"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"keywords":["json","rpc","ethereum","errors","utility"],"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","devDependencies":{"eslint":"^6.1.0","fast-deep-equal":"^2.0.1","tape":"^4.11.0"},"dependencies":{"fast-safe-stringify":"^2.0.6"},"gitHead":"399807e9d210380e277ea0d905b042b2f6469093","_id":"eth-json-rpc-errors@1.1.0","_nodeVersion":"12.6.0","_npmVersion":"6.9.0","dist":{"shasum":"2a4291fb20c0483c99b53286a814ed14ca4efb2e","size":8270,"noattachment":false,"key":"/eth-json-rpc-errors/-/eth-json-rpc-errors-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/eth-json-rpc-errors/download/eth-json-rpc-errors-1.1.0.tgz"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"_npmUser":{"name":"rekmarks","email":"rekmarks@protonmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-json-rpc-errors_1.1.0_1568675093330_0.9305676661993039"},"_hasShrinkwrap":false,"publish_time":1568675093425,"deprecated":"Package renamed: https://www.npmjs.com/package/eth-rpc-errors","_cnpm_publish_time":1568675093425,"_cnpmcore_publish_time":"2021-12-16T15:32:42.753Z"},"1.0.1":{"name":"eth-json-rpc-errors","version":"1.0.1","description":"Ethereum JSON RPC errors and standard JSON RPC 2.0 errors.","main":"index.js","scripts":{"test":"node test","lint":"eslint index.js","lint:fix":"eslint index.js --fix","prepare":"npm run lint:fix && npm run test"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"keywords":["json","rpc","ethereum","errors","utility"],"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","devDependencies":{"eslint":"^6.1.0","fast-deep-equal":"^2.0.1","tape":"^4.11.0"},"dependencies":{"fast-safe-stringify":"^2.0.6"},"gitHead":"8be9088bf736dbed557da9310973484b02d92797","_id":"eth-json-rpc-errors@1.0.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"4204d81167bb49de1f5e7c708d72e52c177c821e","size":8224,"noattachment":false,"key":"/eth-json-rpc-errors/-/eth-json-rpc-errors-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/eth-json-rpc-errors/download/eth-json-rpc-errors-1.0.1.tgz"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"_npmUser":{"name":"rekmarks","email":"rekmarks@protonmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-json-rpc-errors_1.0.1_1566002150267_0.5046741950386244"},"_hasShrinkwrap":false,"publish_time":1566002150371,"deprecated":"Package renamed: https://www.npmjs.com/package/eth-rpc-errors","_cnpm_publish_time":1566002150371,"_cnpmcore_publish_time":"2021-12-16T15:32:42.983Z"},"1.0.0":{"name":"eth-json-rpc-errors","version":"1.0.0","description":"Ethereum JSON RPC errors and standard JSON RPC 2.0 errors.","main":"index.js","scripts":{"test":"node test","lint":"eslint index.js","lint:fix":"eslint index.js --fix","prepare":"npm run lint:fix && npm run test"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"keywords":["json","rpc","ethereum","errors","utility"],"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","devDependencies":{"eslint":"^6.1.0","fast-deep-equal":"^2.0.1","tape":"^4.11.0"},"dependencies":{"fast-safe-stringify":"^2.0.6"},"gitHead":"37d9e57218cf128d6369a6c0b522be690e746508","_id":"eth-json-rpc-errors@1.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"f53a9cf6e31e47582ca1822a945b38c529c28868","size":8259,"noattachment":false,"key":"/eth-json-rpc-errors/-/eth-json-rpc-errors-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/eth-json-rpc-errors/download/eth-json-rpc-errors-1.0.0.tgz"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"_npmUser":{"name":"rekmarks","email":"rekmarks@protonmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-json-rpc-errors_1.0.0_1566001565568_0.22444897165072275"},"_hasShrinkwrap":false,"publish_time":1566001565700,"deprecated":"Package renamed: https://www.npmjs.com/package/eth-rpc-errors","_cnpm_publish_time":1566001565700,"_cnpmcore_publish_time":"2021-12-16T15:32:43.202Z"},"0.3.1":{"name":"eth-json-rpc-errors","version":"0.3.1","description":"Ethereum JSON RPC errors and standard JSON RPC 2.0 errors.","main":"index.js","scripts":{"test":"node test","lint":"eslint index.js","lint:fix":"eslint index.js --fix","prepare":"npm run lint:fix && npm run test"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"keywords":["json","rpc","ethereum","errors","utility"],"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","devDependencies":{"eslint":"^6.1.0","fast-deep-equal":"^2.0.1","tape":"^4.11.0"},"gitHead":"ea8a2c0b1416901234678e9e3afdea7e1dfda685","_id":"eth-json-rpc-errors@0.3.1","_nodeVersion":"12.6.0","_npmVersion":"6.9.0","dist":{"shasum":"fd8a3b21a14ed0a3dceb257a61c3ced28cd8b0b0","size":7499,"noattachment":false,"key":"/eth-json-rpc-errors/-/eth-json-rpc-errors-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/eth-json-rpc-errors/download/eth-json-rpc-errors-0.3.1.tgz"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"_npmUser":{"name":"rekmarks","email":"rekmarks@protonmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-json-rpc-errors_0.3.1_1565389423778_0.18653400281832888"},"_hasShrinkwrap":false,"publish_time":1565389423949,"deprecated":"Package renamed: https://www.npmjs.com/package/eth-rpc-errors","_cnpm_publish_time":1565389423949,"_cnpmcore_publish_time":"2021-12-16T15:32:43.414Z"},"0.3.0":{"name":"eth-json-rpc-errors","version":"0.3.0","description":"Ethereum JSON RPC errors and standard JSON RPC 2.0 errors.","main":"index.js","scripts":{"test":"node test","lint":"eslint index.js","lint:fix":"eslint index.js --fix","prepare":"npm run lint:fix && npm run test"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"keywords":["json","rpc","ethereum","errors","utility"],"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","devDependencies":{"eslint":"^6.1.0","fast-deep-equal":"^2.0.1","tape":"^4.11.0"},"gitHead":"39f040709cd0f90fd7a380efa3946ffe4e8a4758","_id":"eth-json-rpc-errors@0.3.0","_nodeVersion":"12.6.0","_npmVersion":"6.9.0","dist":{"shasum":"9d0b2fbd3a88ec2fc096830023184f4a01014f33","size":7500,"noattachment":false,"key":"/eth-json-rpc-errors/-/eth-json-rpc-errors-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/eth-json-rpc-errors/download/eth-json-rpc-errors-0.3.0.tgz"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"_npmUser":{"name":"rekmarks","email":"rekmarks@protonmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-json-rpc-errors_0.3.0_1565364696076_0.7673671352337357"},"_hasShrinkwrap":false,"publish_time":1565364696248,"deprecated":"Package renamed: https://www.npmjs.com/package/eth-rpc-errors","_cnpm_publish_time":1565364696248,"_cnpmcore_publish_time":"2021-12-16T15:32:43.681Z"},"0.2.0":{"name":"eth-json-rpc-errors","version":"0.2.0","description":"Ethereum JSON RPC errors and standard JSON RPC 2.0 errors.","main":"index.js","scripts":{"test":"node test","lint":"eslint index.js","lint:fix":"eslint index.js --fix","prepare":"npm run lint:fix && npm run test"},"repository":{"type":"git","url":"git+https://github.com/MetaMask/eth-json-rpc-errors.git"},"keywords":["json","rpc","ethereum","errors","utility"],"author":{"name":"Erik Marks","email":"rekmarks@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","devDependencies":{"eslint":"^6.1.0","fast-deep-equal":"^2.0.1","tape":"^4.11.0"},"gitHead":"e4ad694e5e26b8ae6689460c29a2245ec388c8c3","_id":"eth-json-rpc-errors@0.2.0","_nodeVersion":"12.6.0","_npmVersion":"6.9.0","dist":{"shasum":"43b1bb0f3f2240ad5420a1e6a82549748281d2e9","size":7487,"noattachment":false,"key":"/eth-json-rpc-errors/-/eth-json-rpc-errors-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/eth-json-rpc-errors/download/eth-json-rpc-errors-0.2.0.tgz"},"maintainers":[{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"}],"_npmUser":{"name":"rekmarks","email":"rekmarks@protonmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-json-rpc-errors_0.2.0_1565308714245_0.9996302821101837"},"_hasShrinkwrap":false,"publish_time":1565308714379,"deprecated":"Package renamed: https://www.npmjs.com/package/eth-rpc-errors","_cnpm_publish_time":1565308714379,"_cnpmcore_publish_time":"2021-12-16T15:32:43.889Z"}},"readme":"# eth-json-rpc-errors\n\nErrors for the\n[Ethereum JSON RPC](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md)\nand\n[Ethereum Provider](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md),\nand [making unknown errors compliant with either spec](#parsing-unknown-errors).\n\n## Basic Usage\n\n```js\nimport { ethErrors } from 'eth-json-rpc-errors'\n\nthrow ethErrors.provider.unauthorized()\n// or\nthrow ethErrors.provider.unauthorized('my custom message')\n```\n\n## Supported Errors\n\n- Ethereum JSON RPC\n  - Per [EIP 1474](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md#error-codes)\n    - This includes all\n    [JSON RPC 2.0 errors](https://www.jsonrpc.org/specification#error_object)\n- Ethereum Provider errors\n  - Per [EIP 1193](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#error-object-and-codes)\n    - Does **not** yet support [`CloseEvent` errors or status codes](https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes).\n\n## Usage\n\nInstallation: `npm install eth-json-rpc-errors` or `yarn add eth-json-rpc-errors`\n\nImport using ES6 syntax (no default export) or Node `require`.\n\n### Errors API\n\n```js\nimport { ethErrors } from 'eth-json-rpc-errors'\n\n// Ethereum RPC errors are namespaced under \"ethErrors.rpc\"\nresponse.error = ethErrors.rpc.methodNotFound({\n  message: optionalCustomMessage, data: optionalData\n})\n\n// ETH JSON RPC errors namespaced under ethErrors.provider\nresponse.error = ethErrors.provider.unauthorized({\n  message: optionalCustomMessage, data: optionalData\n})\n\n// each error getter takes a single \"opts\" argument\n// for most errors, this can be replaced with a single string, which becomes\n// the error message\nresponse.error = ethErrors.provider.unauthorized(customMessage)\n\n// if an error getter accepts a single string, all arguments can be omitted\nresponse.error = ethErrors.provider.unauthorized()\nresponse.error = ethErrors.provider.unauthorized({})\n\n// omitting the message will produce an error with a default message per\n// the relevant spec\n\n// omitting the data argument will produce an error without a\n// \"data\" property\n\n// the JSON RPC 2.0 server error requires a valid code\nresponse.error = ethErrors.rpc.server({\n  code: -32031\n})\n\n// custom Ethereum Provider errors require a valid code and message\n// valid codes are integers i such that: 1000 <= i <= 4999\nresponse.error = ethErrors.provider.custom({\n  code: 1001, message: 'foo'\n})\n```\n\n### Parsing Unknown Errors\n\n```js\n// this is useful for ensuring your errors are standardized\nimport { serializeError } from 'eth-json-rpc-errors'\n\n// if the argument is not a valid error per any supported spec,\n// it will be added as error.data.originalError\nresponse.error = serializeError(maybeAnError)\n\n// you can add a custom fallback error code and message if desired\nconst fallbackError = { code: 4999, message: 'My custom error.' }\nresponse.error = serializeError(maybeAnError, fallbackError)\n\n// Note: if the original error has a \"message\" property, it will take\n// precedence over the fallback error's message\n\n// the default fallback is:\n{\n  code: -32603,\n  message: 'Internal JSON-RPC error.'\n}\n```\n\n### Other Exports\n\n```js\n/**\n * TypeScript interfaces\n */\nimport {\n  // these describe to the corresponding exports from index.js\n  IEthErrors, IEthereumRpcError, IEthereumProviderError, ISerializeError,\n  // these describe the options argument to error getters in ethErrors\n  IErrorOptions, IRpcServerErrorOptions, IProviderCustomErrorOptions\n} from 'eth-json-rpc-errors/@types'\n\n/**\n * Classes\n */\nimport { EthereumRpcError, EthereumProviderError } from 'eth-json-rpc-errors'\n\n/**\n * getMessageFromCode & ERROR_CODES\n */\nimport { getMessageFromCode, ERROR_CODES } from 'eth-json-rpc-errors'\n\n// get the default message string for the given code, or a fallback message if\n// no message exists for the given code\nconst message1 = getMessageFromCode(someCode)\n\n// you can specify your own fallback message\nconst message2 = getMessageFromCode(someCode, myFallback)\n// it can be anything, use at your own peril\nconst message3 = getMessageFromCode(someCode, null)\n\n// {\n//   jsonRpc: { [errorName]: code, ... },\n//   eth: { [errorName]: code, ... },\n// }\nconst code1 = ERROR_CODES.rpc.parse\nconst code2 = ERROR_CODES.provider.userRejectedRequest\n\n// all codes in ERROR_CODES have default messages\nconst message4 = getMessageFromCode(code1)\nconst message5 = getMessageFromCode(code2)\n```\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/MetaMask/eth-json-rpc-errors#readme","bugs":{"url":"https://github.com/MetaMask/eth-json-rpc-errors/issues"},"license":"MIT"}