Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
json-rpc-error
Advanced tools
Readme
Error constructors for JSON RPC 2.0 errors as described in the [JSON-RPC 2.0 Error Specification] (http://www.jsonrpc.org/specification#error_object)
code | message | meaning |
---|---|---|
-32700 | Parse error | Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text. |
-32600 | Invalid Request | The JSON sent is not a valid Request object. |
-32601 | Method not found | The method does not exist / is not available. |
-32602 | Invalid params | Invalid method parameter(s). |
-32603 | Internal error | Internal JSON-RPC error. |
-32000 to -32099 | Server error | Reserved for implementation-defined server-errors. |
Specific errors are instances of the base constructor JsonRpcError
, which in
turn is an instance of the native JavaScript Error object.
Each error can be constructed with or without the new
keyword, for example
var err = new JsonRpcError.ParseError();
is the same as
var err = JsonRpcError.ParseError();
Also see related packages json-rpc-response, json-rpc-request, and json-rpc-notification
Import the JSON RPC 2.0 error module:
var JsonRpcError = require('json-rpc-error');
General base constructor for JSON RPC 2 errors:
new JsonRpcError.JsonRpcError(message, code[, data]);
Invalid JSON was received by the server.
new JsonRpcError.ParseError();
The JSON sent is not a valid Request object.
new JsonRpcError.InvalidRequest();
The method does not exist / is not available.
new JsonRpcError.MethodNotFound();
Invalid method parameter(s).
new JsonRpcError.InvalidParams();
Internal JSON-RPC error. The constructor can take an optional error object, in
which case the error's message
property will be passed on.
new JsonRpcError.InternalError([error]);
Reserved for implementation-defined server-errors. Provided error code must be in the range -32000 to -32099.
new JsonRpcError.InternalError(code);
Run unit tests:
$ npm test
Create test coverage report:
$ npm run-script test-cov
FAQs
JSON RPC 2.0 Errors.
The npm package json-rpc-error receives a total of 28,860 weekly downloads. As such, json-rpc-error popularity was classified as popular.
We found that json-rpc-error demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.