mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
Correct error handling on createMarshalledReply.
This commit correctly sets the error in the marhsalled reply if it is already a *btcjson.Error. Previously it would only set the error if it was not of that type which led to some RPC results showing no error when they actually had one.
This commit is contained in:
parent
bdaa5f7f8d
commit
27082ace79
@ -832,10 +832,12 @@ type wsResponse struct {
|
||||
func createMarshalledReply(id, result interface{}, replyErr error) ([]byte, error) {
|
||||
var jsonErr *btcjson.Error
|
||||
if replyErr != nil {
|
||||
if jErr, ok := replyErr.(*btcjson.Error); !ok {
|
||||
if jErr, ok := replyErr.(*btcjson.Error); ok {
|
||||
jsonErr = jErr
|
||||
} else {
|
||||
jsonErr = &btcjson.Error{
|
||||
Code: btcjson.ErrInternal.Code,
|
||||
Message: jErr.Error(),
|
||||
Message: replyErr.Error(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user