diff --git a/reflector/blocklist.go b/reflector/blocklist.go index 8b814f3..0e242f3 100644 --- a/reflector/blocklist.go +++ b/reflector/blocklist.go @@ -60,7 +60,7 @@ func blockedSdHashes() (map[string]valOrErr, error) { defer func() { err := resp.Body.Close() if err != nil { - log.Errorln(err) + log.Errorln(errors.Err(err)) } }() @@ -102,7 +102,7 @@ func sdHashesForOutpoints(outpoints []string) (map[string]valOrErr, error) { "spv9.lbry.com:50001", }, nil) if err != nil { - return nil, err + return nil, errors.Err(err) } for _, outpoint := range outpoints { diff --git a/wallet/client.go b/wallet/client.go index afee748..5482574 100644 --- a/wallet/client.go +++ b/wallet/client.go @@ -43,12 +43,12 @@ func (n *Node) Resolve(url string) (*types.Output, error) { b, err := base64.StdEncoding.DecodeString(resp.Result) if err != nil { - return nil, err + return nil, errors.Err(err) } err = proto.Unmarshal(b, outputs) if err != nil { - return nil, err + return nil, errors.Err(err) } if len(outputs.GetTxos()) != 1 { diff --git a/wallet/network.go b/wallet/network.go index 4c97318..7ff05af 100644 --- a/wallet/network.go +++ b/wallet/network.go @@ -63,7 +63,7 @@ func NewNode() *Node { // Connect creates a new connection to the specified address. func (n *Node) Connect(addrs []string, config *tls.Config) error { if n.transport != nil { - return ErrNodeConnected + return errors.Err(ErrNodeConnected) } // shuffle addresses for load balancing @@ -80,11 +80,11 @@ func (n *Node) Connect(addrs []string, config *tls.Config) error { // net.errNoSuchHost is not exported, so we have to string-match continue } - return err + return errors.Err(err) } if n.transport == nil { - return ErrConnectFailed + return errors.Err(ErrConnectFailed) } log.Debugf("wallet connected to %s", n.transport.conn.RemoteAddr()) @@ -121,7 +121,7 @@ func (n *Node) handleErrors() { case <-n.grp.Ch(): return case err := <-n.transport.Errors(): - n.err(err) + n.err(errors.Err(err)) } } } @@ -176,7 +176,7 @@ func (n *Node) listen() { r.err = errors.Err(err) n.err(r.err) } else if len(msg.Error.Message) > 0 { - r.err = errors.Base("%d: %s", msg.Error.Code, msg.Error.Message) + r.err = errors.Err("%d: %s", msg.Error.Code, msg.Error.Message) } else { r.data = bytes } @@ -228,7 +228,7 @@ func (n *Node) request(method string, params []string, v interface{}) error { bytes, err := json.Marshal(msg) if err != nil { - return err + return errors.Err(err) } bytes = append(bytes, delimiter) @@ -240,7 +240,7 @@ func (n *Node) request(method string, params []string, v interface{}) error { err = n.transport.Send(bytes) if err != nil { - return err + return errors.Err(err) } var r response @@ -255,7 +255,7 @@ func (n *Node) request(method string, params []string, v interface{}) error { n.handlersMu.Unlock() if r.err != nil { - return r.err + return errors.Err(r.err) } return errors.Err(json.Unmarshal(r.data, v))