rpcserver: Update error case handling in tests.
This updates the rpcserver handler tests to properly call Errorf in the case that the test specifies wantErr, but err is nil.
This commit is contained in:
parent
58b094f0fa
commit
faec0f8280
@ -3370,7 +3370,11 @@ func testRPCServerHandler(t *testing.T, tests []rpcTest) {
|
||||
if test.wantErr {
|
||||
var rpcErr *dcrjson.RPCError
|
||||
if !errors.As(err, &rpcErr) || rpcErr.Code != test.errCode {
|
||||
t.Errorf("%s\nwant: %+v\n got: %+v\n", test.name, test.errCode, rpcErr.Code)
|
||||
if rpcErr != nil {
|
||||
t.Errorf("%s\nwant: %+v\n got: %+v\n", test.name, test.errCode, rpcErr.Code)
|
||||
} else {
|
||||
t.Errorf("%s\nwant: %+v\n got: nil\n", test.name, test.errCode)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user