mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-08-23 17:47:24 +00:00
rpcserver: Fix Error message returned by processRequest
When processRequest can't find a rpc command, standardCmdResult returns a `btcjson.ErrRPCMethodNotFound` but it gets ignored and a `btcjson.ErrRPCInvalidRequest` is returned instead. This makes processRequest return the right error message.
This commit is contained in:
parent
d08785547a
commit
556620fea6
1 changed files with 7 additions and 3 deletions
10
rpcserver.go
10
rpcserver.go
|
@ -4066,9 +4066,13 @@ func (s *rpcServer) processRequest(request *btcjson.Request, isAdmin bool, close
|
||||||
result, err = s.standardCmdResult(parsedCmd,
|
result, err = s.standardCmdResult(parsedCmd,
|
||||||
closeChan)
|
closeChan)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonErr = &btcjson.RPCError{
|
if rpcErr, ok := err.(*btcjson.RPCError); ok {
|
||||||
Code: btcjson.ErrRPCInvalidRequest.Code,
|
jsonErr = rpcErr
|
||||||
Message: "Invalid request: malformed",
|
} else {
|
||||||
|
jsonErr = &btcjson.RPCError{
|
||||||
|
Code: btcjson.ErrRPCInvalidRequest.Code,
|
||||||
|
Message: "Invalid request: malformed",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue