more error traces

This commit is contained in:
Alex Grintsvayg 2020-02-26 10:02:53 -05:00
parent d1063bd54e
commit 1a1f991e48
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5
3 changed files with 12 additions and 12 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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))