add traces to unmarshall errors

This commit is contained in:
Alex Grintsvayg 2020-02-25 15:49:51 -05:00
parent a939529d19
commit d291c063ec
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5
4 changed files with 7 additions and 7 deletions

View file

@ -141,9 +141,9 @@ func loadConfig(path string) (Config, error) {
if os.IsNotExist(err) {
return c, errors.Err("config file not found")
}
return c, err
return c, errors.Err(err)
}
err = json.Unmarshal(raw, &c)
return c, err
return c, errors.Err(err)
}

View file

@ -159,7 +159,7 @@ func (s *Server) handleAvailabilityRequest(data []byte) ([]byte, error) {
var request availabilityRequest
err := json.Unmarshal(data, &request)
if err != nil {
return nil, err
return nil, errors.Err(err)
}
availableBlobs := []string{}
@ -220,7 +220,7 @@ func (s *Server) handleCompositeRequest(data []byte) ([]byte, error) {
var request compositeRequest
err := json.Unmarshal(data, &request)
if err != nil {
return nil, err
return nil, errors.Err(err)
}
response := compositeResponse{

View file

@ -51,7 +51,7 @@ func (d *DBBackedStore) PutSD(hash string, blob stream.Blob) error {
var blobContents db.SdBlob
err := json.Unmarshal(blob, &blobContents)
if err != nil {
return err
return errors.Err(err)
}
if blobContents.StreamHash == "" {
return errors.Err("sd blob is missing stream hash")

View file

@ -173,8 +173,8 @@ func (n *Node) listen() {
}
if err != nil {
n.err(err)
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)
} else {
@ -258,5 +258,5 @@ func (n *Node) request(method string, params []string, v interface{}) error {
return r.err
}
return json.Unmarshal(r.data, v)
return errors.Err(json.Unmarshal(r.data, v))
}