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

Side by Side Diff: dm/appengine/deps/service.go

Issue 2951393002: [errors] de-specialize Transient in favor of Tags. (Closed)
Patch Set: more refactor Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package deps 5 package deps
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "os" 9 "os"
10 10
(...skipping 17 matching lines...) Expand all
28 28
29 func depsServerPrelude(c context.Context, methodName string, req proto.Message) (context.Context, error) { 29 func depsServerPrelude(c context.Context, methodName string, req proto.Message) (context.Context, error) {
30 // Many of the DM request messages can be Normalize'd. This checks them for 30 // Many of the DM request messages can be Normalize'd. This checks them for
31 // basic validity and normalizes cases where multiple representations ca n mean 31 // basic validity and normalizes cases where multiple representations ca n mean
32 // the same thing so that the service handlers only need to check for th e 32 // the same thing so that the service handlers only need to check for th e
33 // canonical representation. 33 // canonical representation.
34 if norm, ok := req.(interface { 34 if norm, ok := req.(interface {
35 Normalize() error 35 Normalize() error
36 }); ok { 36 }); ok {
37 if err := norm.Normalize(); err != nil { 37 if err := norm.Normalize(); err != nil {
38 » » » return nil, grpcutil.Annotate(err, codes.InvalidArgument ).Reason("invalid request").Err() 38 » » » return nil, grpcAnnotate(err, codes.InvalidArgument).Rea son("invalid request").Err()
39 } 39 }
40 } 40 }
41 return c, nil 41 return c, nil
42 } 42 }
43 43
44 const postludeDebugEnvvar = "DUMP_ALL_STACKS" 44 const postludeDebugEnvvar = "DUMP_ALL_STACKS"
45 45
46 var postludeOmitCodes = map[codes.Code]struct{}{ 46 var postludeOmitCodes = map[codes.Code]struct{}{
47 codes.OK: {}, 47 codes.OK: {},
48 codes.Unauthenticated: {}, 48 codes.Unauthenticated: {},
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // to codes.Internal. 93 // to codes.Internal.
94 func tumbleNow(c context.Context, m tumble.Mutation) error { 94 func tumbleNow(c context.Context, m tumble.Mutation) error {
95 err := tumble.RunMutation(c, m) 95 err := tumble.RunMutation(c, m)
96 if grpc.Code(err) == codes.Unknown { 96 if grpc.Code(err) == codes.Unknown {
97 logging.WithError(err).Errorf(c, "unknown error while applying m utation %v", m) 97 logging.WithError(err).Errorf(c, "unknown error while applying m utation %v", m)
98 err = grpcutil.Internal 98 err = grpcutil.Internal
99 } 99 }
100 logging.Fields{"root": m.Root(c)}.Infof(c, "tumbleNow success") 100 logging.Fields{"root": m.Root(c)}.Infof(c, "tumbleNow success")
101 return err 101 return err
102 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698