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
1 changed files with 4 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue