| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |