Skip to content

Non-specific error for JSON-RPC specification #297

@im-kulikov

Description

@im-kulikov

This error is reproduced on versions 2.8.0-2.9.1

How to reproduce:

  • just use image: cityofzion/neo-privatenet:2.9.1
  • make request (for example):
## Submit block
curl -X "POST" "http://127.0.0.1:30333/" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -H 'Accept-Encoding: gzip, zlib, deflate, zstd, br' \
     -d $'{
  "jsonrpc": "2.0",
  "method": "sendtoaddress",
  "id": 1,
  "params": []
}'
  • response:
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -2146233086,
    "message": "Index was out of range. Must be non-negative and less than the size of the collection.\nParameter name: index"
  }
}

"Index was out of range. Must be non-negative and less than the size of the collection.\nParameter name: index"

this is a specific for C# exception

The JSON-RPC (https://www.jsonrpc.org/specification#error_object) says that "error codes from and including -32768 to -32000 are reserved for pre-defined errors". In this case, the application itself is providing an specific error. I think that if no param is given, error -32602 should be raised, then.

Message must be something like "Method require params"

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionIssue state: Proposed, to be discussed by the community.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions