|
[errors] de-specialize Transient in favor of Tags.
Previously 'transience' was a hard-coded attribute of the errors package. This
change adds 'tags' as a way to put attributes (potentially with some data) onto an
error as it goes up the stack.
This removes multiple symbols from the errors package (the stack context stuff
is now an implementation detail, tags are better than ExtractData).
The 'transience' bit has now moved to the 'common/retry/transient' package.
Marking an error as transient is now `err = transient.Tag.Apply(err)`, or
`errors.Annotate(err).Tag(transient.Tag).Err()` (as part of another batch
of annotations).
API Review in a Nutshell:
// for simple 'boolean' tags, where presence is the only important piece of
// information.
var FatalTag = errors.BoolTag{errors.NewTagKey("this is a fatal error!")}
func (...) error {
return FatalTag.Apply(err)
}
func (...) {
if FatalTag.In(err) {
os.Exit(-1)
}
}
// tags may also have associated typesafe values
type Severity int
type severityTagType struct {Key errors.TagKey}
func (t severityTagType) With(s Severity) errors.TagValue { return errors.MkTagValue(t.Key, s) }
func (t severityTagType) In(err error) (s Severity, ok bool) {
d, ok := errors.TagValueIn(t.Key, err)
if ok {
s = d.(Severity)
}
return
}
var SeverityTag = severityTagType{errors.NewTagKey("holds a Severity value")}
func (...) error {
return SeverityTag.With(Severity(10)).Apply(err)
}
func (...) {
if s, hasSeverity := SeverityTag.In(err); hasSeverity {
if s.(Severity) > 9000 {
fmt.Println("it's pretty severe")
}
}
}
BUG=
Review-Url: https://codereview.chromium.org/2951393002
Committed: https://github.com/luci/luci-go/commit/585415ced4abef0b0ceff6c495690df98db83abb
Total comments: 35
Total comments: 1
Total comments: 6
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+879 lines, -583 lines) |
Patch |
 |
M |
appengine/datastorecache/cache.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
appengine/gaeauth/client/client.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
appengine/gaeauth/server/cache.go
|
View
|
1
2
3
4
5
|
3 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
 |
M |
appengine/gaeauth/server/internal/authdbimpl/authdb.go
|
View
|
1
2
3
4
5
|
6 chunks |
+6 lines, -5 lines |
0 comments
|
Download
|
 |
M |
appengine/gaeauth/server/internal/authdbimpl/handlers.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
appengine/gaeauth/server/oauth.go
|
View
|
1
2
3
4
5
|
3 chunks |
+4 lines, -2 lines |
0 comments
|
Download
|
 |
M |
appengine/gaeauth/server/session.go
|
View
|
1
2
3
4
5
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
appengine/gaesecrets/gaesecrets.go
|
View
|
1
2
3
4
5
|
4 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
 |
M |
appengine/gaesettings/gaesettings.go
|
View
|
1
2
3
4
5
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
buildbucket/client/cmd/buildbucket/client.go
|
View
|
1
2
3
4
5
|
3 chunks |
+4 lines, -5 lines |
0 comments
|
Download
|
 |
M |
cipd/client/cipd/client.go
|
View
|
1
2
3
4
5
|
2 chunks |
+9 lines, -8 lines |
0 comments
|
Download
|
 |
M |
cipd/client/cli/main.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
common/auth/auth.go
|
View
|
1
2
3
4
5
6
7
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
common/auth/auth_test.go
|
View
|
1
2
3
4
5
|
3 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
common/auth/internal/common.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
common/auth/internal/disk_cache.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
common/auth/internal/iam.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
common/auth/internal/luci_ctx.go
|
View
|
1
2
3
4
5
|
2 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
common/auth/internal/luci_ctx_test.go
|
View
|
1
2
3
4
5
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
common/auth/internal/service.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
common/auth/internal/user.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
common/auth/localauth/server.go
|
View
|
1
2
3
4
5
|
3 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
 |
M |
common/auth/localauth/server_test.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
common/config/impl/remote/remote.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
common/config/validation/validation.go
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+28 lines, -2 lines |
0 comments
|
Download
|
 |
M |
common/config/validation/validation_test.go
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+7 lines, -3 lines |
0 comments
|
Download
|
 |
M |
common/errors/annotate.go
|
View
|
1
2
3
4
5
6
7
8
|
18 chunks |
+114 lines, -103 lines |
0 comments
|
Download
|
 |
M |
common/errors/multierror.go
|
View
|
1
2
3
4
5
|
1 chunk |
+4 lines, -5 lines |
0 comments
|
Download
|
 |
A |
common/errors/tags.go
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+160 lines, -0 lines |
4 comments
|
Download
|
 |
A |
common/errors/tags_test.go
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+134 lines, -0 lines |
0 comments
|
Download
|
 |
D |
common/errors/transient.go
|
View
|
|
1 chunk |
+0 lines, -65 lines |
0 comments
|
Download
|
 |
D |
common/errors/transient_test.go
|
View
|
|
1 chunk |
+0 lines, -49 lines |
0 comments
|
Download
|
 |
M |
common/errors/walk_test.go
|
View
|
|
2 chunks |
+0 lines, -2 lines |
0 comments
|
Download
|
 |
M |
common/gcloud/googleoauth/info.go
|
View
|
1
2
3
4
5
|
4 chunks |
+4 lines, -3 lines |
0 comments
|
Download
|
 |
M |
common/gcloud/gs/gs.go
|
View
|
1
2
3
4
5
|
5 chunks |
+5 lines, -4 lines |
0 comments
|
Download
|
 |
M |
common/gcloud/gs/writer.go
|
View
|
1
2
3
4
5
|
3 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
common/lhttp/client.go
|
View
|
1
2
3
4
5
|
4 chunks |
+9 lines, -7 lines |
0 comments
|
Download
|
 |
M |
common/retry/transient.go
|
View
|
1
2
3
4
5
|
1 chunk |
+0 lines, -40 lines |
0 comments
|
Download
|
 |
A |
common/retry/transient/transient.go
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+68 lines, -0 lines |
0 comments
|
Download
|
 |
D |
common/retry/wrap.go
|
View
|
1
2
3
4
5
|
1 chunk |
+0 lines, -17 lines |
0 comments
|
Download
|
 |
M |
common/testing/assertions/grpc.go
|
View
|
1
2
3
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
dm/appengine/deps/auth.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
dm/appengine/deps/ensure_graph_data.go
|
View
|
1
|
5 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
 |
M |
dm/appengine/deps/service.go
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
A |
dm/appengine/deps/util.go
|
View
|
1
|
1 chunk |
+15 lines, -0 lines |
0 comments
|
Download
|
 |
M |
dm/appengine/mutate/add_deps.go
|
View
|
|
3 chunks |
+5 lines, -2 lines |
0 comments
|
Download
|
 |
M |
dm/appengine/mutate/finish_attempt.go
|
View
|
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
dm/appengine/mutate/schedule_execution.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
dm/appengine/mutate/schedule_execution_test.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
grpc/grpcutil/errors.go
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+21 lines, -12 lines |
2 comments
|
Download
|
 |
M |
grpc/prpc/client.go
|
View
|
1
2
3
4
5
|
5 chunks |
+6 lines, -4 lines |
0 comments
|
Download
|
 |
M |
grpc/prpc/client_test.go
|
View
|
1
2
3
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
grpc/prpc/encoding.go
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
grpc/prpc/server.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
logdog/appengine/coordinator/endpoints/logs/get.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
logdog/client/butler/output/pubsub/pubsubOutput.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
logdog/common/archive/archive.go
|
View
|
|
2 chunks |
+0 lines, -5 lines |
0 comments
|
Download
|
 |
M |
logdog/common/storage/bigtable/bigtable.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
logdog/common/storage/bigtable/initialize.go
|
View
|
1
2
3
4
5
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
logdog/server/archivist/archivist.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
logdog/server/archivist/archivist_test.go
|
View
|
1
2
3
4
5
|
7 chunks |
+7 lines, -6 lines |
0 comments
|
Download
|
 |
M |
logdog/server/cmd/logdog_archivist/main.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
logdog/server/cmd/logdog_collector/main.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
logdog/server/collector/collector_test.go
|
View
|
1
2
3
4
5
|
15 chunks |
+16 lines, -15 lines |
0 comments
|
Download
|
 |
M |
logdog/server/collector/coordinator/cache.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
logdog/server/collector/coordinator/cache_test.go
|
View
|
1
2
3
4
5
|
3 chunks |
+4 lines, -3 lines |
0 comments
|
Download
|
 |
M |
logdog/server/retryServicesClient/client.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
milo/build_source/buildbucket/builder.go
|
View
|
1
2
3
4
5
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
scheduler/appengine/engine/engine.go
|
View
|
1
2
3
4
5
|
26 chunks |
+27 lines, -27 lines |
0 comments
|
Download
|
 |
M |
scheduler/appengine/engine/engine_test.go
|
View
|
1
2
3
4
5
|
4 chunks |
+5 lines, -4 lines |
0 comments
|
Download
|
 |
M |
scheduler/appengine/engine/pubsub.go
|
View
|
1
2
3
4
5
|
4 chunks |
+4 lines, -3 lines |
0 comments
|
Download
|
 |
M |
scheduler/appengine/frontend/handler.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
scheduler/appengine/task/buildbucket/buildbucket.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
scheduler/appengine/task/swarming/swarming.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
scheduler/appengine/task/utils/apiclient.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
server/auth/actor.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -3 lines |
0 comments
|
Download
|
 |
M |
server/auth/auth.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
server/auth/auth_test.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
server/auth/delegation.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
server/auth/delegation/checker.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
server/auth/internal/fetch.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
server/auth/openid/cookie.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
server/auth/openid/method.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
server/auth/xsrf/xsrf.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
server/settings/admin/handlers.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
server/settings/settings.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/certchecker/certchecker.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/certconfig/ca.go
|
View
|
1
2
3
4
5
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/certconfig/crl.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/certconfig/rpc_fetch_crl.go
|
View
|
1
2
3
4
5
|
6 chunks |
+8 lines, -6 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/delegation/rpc_mint_delegation_token.go
|
View
|
1
2
3
4
5
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/machinetoken/machinetoken.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/machinetoken/rpc_inspect_machine_token.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/machinetoken/rpc_mint_machine_token.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/utils/bqlog/bqlog.go
|
View
|
1
2
3
4
5
|
4 chunks |
+4 lines, -3 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/utils/bqlog/bqlog_test.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/utils/policy/entities.go
|
View
|
1
2
3
4
5
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/utils/revocation/id.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/utils/tokensigning/inspector.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
tokenserver/appengine/impl/utils/tokensigning/signer.go
|
View
|
1
2
3
4
5
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
tokenserver/auth/machine/auth_method.go
|
View
|
1
2
3
4
5
|
4 chunks |
+5 lines, -4 lines |
0 comments
|
Download
|
 |
M |
tokenserver/client/tokenclient.go
|
View
|
1
2
3
4
5
|
3 chunks |
+8 lines, -10 lines |
0 comments
|
Download
|
 |
M |
tumble/process.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
tumble/service.go
|
View
|
1
2
3
4
5
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
Dependent Patchsets:
Total messages: 48 (35 generated)
|