Merge pull request #391 from fkautz/pr_out_addnode_fails_with_proper_error_code_when_bucketid_is_malformed

This commit is contained in:
Frederick F. Kautz IV 2015-03-26 10:42:42 -07:00
commit 3c37218d7d
1 changed files with 3 additions and 5 deletions

View File

@ -23,12 +23,10 @@ func (b donutBucket) GetNodes() ([]string, error) {
// AddNode - adds a node to a bucket
func (b donutBucket) AddNode(nodeID, bucketID string) error {
errParams := map[string]string{"node": nodeID, "bucketID": bucketID}
tokens := strings.Split(bucketID, ":")
if len(tokens) != 3 {
var err error
err = iodine.Error(nil, nil)
return err
// return iodine.Error(errors.New("Bucket ID malformed: "+bucketID), map[string]string{"nodeID": nodeID, "bucketID": bucketID})
return iodine.Error(errors.New("Bucket ID malformeD: "+bucketID), errParams)
}
// bucketName := tokens[0]
@ -36,7 +34,7 @@ func (b donutBucket) AddNode(nodeID, bucketID string) error {
// aggregate := "0"
part, err := strconv.Atoi(tokens[2])
if err != nil {
return iodine.Error(errors.New("Part malformed: "+tokens[2]), map[string]string{"nodeID": nodeID, "bucketID": bucketID})
return iodine.Error(errors.New("Part malformed: "+tokens[2]), errParams)
}
b.nodes[part] = nodeID
return nil