Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: common/errors/tags.go

Issue 2963503003: [errors] Greatly simplify common/errors package. (Closed)
Patch Set: all tests passing Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: common/errors/tags.go
diff --git a/common/errors/tags.go b/common/errors/tags.go
index b80f135c94bda7fa9280987201735df73a0155ed..743cef594427a5b9de26d75afdd4f5787c8edee8 100644
--- a/common/errors/tags.go
+++ b/common/errors/tags.go
@@ -5,11 +5,6 @@
package errors
type (
- // TagKeyOrValue is used for functions taking either a TagKey or a TagValue.
- TagKeyOrValue interface {
- isTagKeyOrValue()
- }
-
tagDescription struct {
description string
}
@@ -54,7 +49,7 @@ func TagValueIn(t TagKey, err error) (value interface{}, ok bool) {
func (t TagValue) GenerateErrorTagValue() TagValue { return t }
// Apply applies this tag value (key+value) directly to the error. This is
-// a shortcut for `errors.Annotate(err).Tag(t).Err()`.
+// a shortcut for `errors.Annotate(err, "").Tag(t).Err()`.
func (t TagValue) Apply(err error) error {
if err == nil {
return nil
@@ -63,11 +58,6 @@ func (t TagValue) Apply(err error) error {
return a.Tag(t).Err()
}
-// MkTagValue is a shortcut for errors.TagValue{Key: key, Value: val}.
-func MkTagValue(key TagKey, val interface{}) TagValue {
- return TagValue{key, val}
-}
-
// BoolTag is an error tag implementation which holds a boolean value.
//
// It should be constructed like:
@@ -118,7 +108,7 @@ func (b BoolTag) In(err error) bool {
// type SomeType int
// type myTag struct { Key errors.TagKey }
// func (m myTag) With(value SomeType) errors.TagValue {
-// return errors.MkTagValue(vm.Key, value)
+// return errors.TagValue{Key: vm.Key, Value: value}
// }
// func (m myTag) In(err error) (v SomeType, ok bool) {
// d, ok := errors.TagValueIn(m.Key, err)

Powered by Google App Engine
This is Rietveld 408576698