Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(202)

Unified Diff: state/annotator.go

Issue 70770043: all: use errgo instead of fmt.Errorf
Patch Set: all: use errgo instead of fmt.Errorf Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « state/address.go ('k') | state/api/agent/state.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: state/annotator.go
=== modified file 'state/annotator.go'
--- state/annotator.go 2013-07-30 10:23:10 +0000
+++ state/annotator.go 2014-03-03 12:02:05 +0000
@@ -4,9 +4,9 @@
package state
import (
- "fmt"
"strings"
+ "github.com/juju/errgo/errors"
"labix.org/v2/mgo"
"labix.org/v2/mgo/txn"
@@ -44,7 +44,7 @@
toUpdate := make(map[string]string)
for key, value := range pairs {
if strings.Contains(key, ".") {
- return fmt.Errorf("invalid key %q", key)
+ return errors.Newf("invalid key %q", key)
}
if value == "" {
toRemove["annotations."+key] = true
@@ -67,7 +67,7 @@
} else if count == 0 {
// Check that the annotator entity was not previously destroyed.
if i != 0 {
- return fmt.Errorf("%s no longer exists", a.tag)
+ return errors.Newf("%s no longer exists", a.tag)
}
ops, err = a.insertOps(toInsert)
if err != nil {
« no previous file with comments | « state/address.go ('k') | state/api/agent/state.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b