.. default-domain:: cpp
A list of codes and descriptions of errors that could be send back from the JSONRPC server. JSONRPC response messages could contains different set of errors in the following format:
Note
Check :ref:`jsonrpc-error` for details about the error structure.
In some cases the data field could be populated. Each entry in the data array contains a
code, a severity, and a message:
{
"jsonrpc": "2.0",
"error":{
"code": 10,
"message": "Unauthorized action",
"data":[
{
"code": 2,
"severity": 5,
"message":"Denied privileged API access for uid=XXX gid=XXX"
}
]
},
"id":"5e273ec0-3e3b-4a81-90ec-aeee3d38073f"
}The severity field is an integer that corresponds to the swoc::Errata::Severity levels.
It is always present in the response. If the handler does not set an explicit severity for an
annotation, the server defaults to 0 (Diag).
| Code | Severity |
|---|---|
| 0 | Diag |
| 1 | Debug |
| 2 | Status |
| 3 | Note |
| 4 | Warn |
| 5 | Error |
| 6 | Fatal |
| 7 | Alert |
| 8 | Emergency |
The severity field is used by :program:`traffic_ctl` to determine the exit code via the
--error-level option. See :ref:`traffic_ctl_jsonrpc` for details.
| Id | Message | Description |
|---|---|---|
| -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 JSONRPC error. |
The following error list are defined by the server.
| Id | Message | Description |
|---|---|---|
| 1 | Invalid version, 2.0 only | The server only accepts version field equal to 2.0. |
| 2 | Invalid version type, should be a string | Version field should be a literal string. |
| 3 | Missing version field | No version field present, version field is mandatory. |
| 4 | Invalid method type, should be a string | The method field should be a literal string. |
| 5 | Missing method field | No method field present, method field is mandatory. |
| 6 | Invalid params type. A Structured value is expected | Params field should be a structured type, list or structure. This is similar to -32602 |
| 7 | Invalid id type | If field should be a literal string. |
| 8 | Use of null as id is discouraged | Id field value is null, as per the specs this is discouraged, the server will not accept it. |
| 9 | Error during execution | An error occurred during the execution of the RPC call.
This error is used as a generic High level error. The specifics
details about the error, in most cases are specified in the
data field. |
| 10 | Unauthorized action | The rpc method will not be invoked because the action is not permitted by some constraint or authorization issue.Check :ref:`jsonrpc-node-errors-unauthorized-action` for mode details. |
| 11 | Use of an empty string as id is discouraged | An empty string "" as an id will not be accepted by the server. |
Under this error, the data field could be populated with the following errors, eventually more than one could be in set.
"data":[
{
"code":2,
"severity": 5,
"message":"Denied privileged API access for uid=XXX gid=XXX"
}
]| Id | Message | Description |
|---|---|---|
| 1 | Error getting peer credentials: {} | Something happened while trying to get the peers credentials. The error string will show the error code(errno) returned by the server. |
| 2 | Denied privileged API access for uid={} gid={} | Permission denied. Unix Socket credentials were checked and they haven't meet the required policy. The handler was configured as restricted and the socket credentials failed to validate. Check TBC for more information. |