mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 03:41:45 +00:00
rpcsrv: improve error formatting
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
97a57de82d
commit
aeb7ee1021
2 changed files with 2 additions and 2 deletions
|
@ -2487,7 +2487,7 @@ func (s *Server) traverseIterator(reqParams params.Params) (any, *neorpc.Error)
|
|||
return nil, neorpc.NewInvalidParamsError("invalid iterator items count: not an int32")
|
||||
}
|
||||
if count > s.config.MaxIteratorResultItems {
|
||||
return nil, neorpc.NewInvalidParamsError(fmt.Sprintf("iterator items count is out of range (%d at max)", s.config.MaxIteratorResultItems))
|
||||
return nil, neorpc.NewInvalidParamsError(fmt.Sprintf("iterator items count (%d) is out of range (%d at max)", count, s.config.MaxIteratorResultItems))
|
||||
}
|
||||
|
||||
s.sessionsLock.Lock()
|
||||
|
|
|
@ -2975,7 +2975,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
|
|||
sID, iID := prepareIteratorSession(t)
|
||||
rpc := fmt.Sprintf(`{"jsonrpc": "2.0", "id": 1, "method": "traverseiterator", "params": ["%s", "%s", %d]}"`, sID.String(), iID.String(), config.DefaultMaxIteratorResultItems+1)
|
||||
body := doRPCCall(rpc, httpSrv.URL, t)
|
||||
checkErrGetResult(t, body, true, neorpc.InvalidParamsCode, fmt.Sprintf("iterator items count is out of range (%d at max)", config.DefaultMaxIteratorResultItems))
|
||||
checkErrGetResult(t, body, true, neorpc.InvalidParamsCode, fmt.Sprintf("iterator items count (%d) is out of range (%d at max)", config.DefaultMaxIteratorResultItems+1, config.DefaultMaxIteratorResultItems))
|
||||
})
|
||||
t.Run("unknown session", func(t *testing.T) {
|
||||
_, iID := prepareIteratorSession(t)
|
||||
|
|
Loading…
Reference in a new issue