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

Side by Side Diff: dm/appengine/mutate/add_deps.go

Issue 2963503003: [errors] Greatly simplify common/errors package. (Closed)
Patch Set: fix nits 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
« no previous file with comments | « dm/appengine/distributor/swarming/v1/isolate.go ('k') | dm/appengine/mutate/finish_attempt.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 mutate 5 package mutate
6 6
7 import ( 7 import (
8 ds "github.com/luci/gae/service/datastore" 8 ds "github.com/luci/gae/service/datastore"
9 "github.com/luci/luci-go/common/data/bit_field" 9 "github.com/luci/luci-go/common/data/bit_field"
10 "github.com/luci/luci-go/common/errors" 10 "github.com/luci/luci-go/common/errors"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if err != nil { 44 if err != nil {
45 return 45 return
46 } 46 }
47 47
48 if err = ResetExecutionTimeout(c, ex); err != nil { 48 if err = ResetExecutionTimeout(c, ex); err != nil {
49 logging.WithError(err).Errorf(c, "could not reset timeout") 49 logging.WithError(err).Errorf(c, "could not reset timeout")
50 return 50 return
51 } 51 }
52 52
53 fwdDeps, err := filterExisting(c, model.FwdDepsFromList(c, a.Auth.Id.Att emptID(), a.Deps)) 53 fwdDeps, err := filterExisting(c, model.FwdDepsFromList(c, a.Auth.Id.Att emptID(), a.Deps))
54 » err = errors.Annotate(err).Tag(grpcutil.Tag.With(codes.Internal)). 54 » err = errors.Annotate(err, "while filtering deps").Tag(grpcutil.Tag.With (codes.Internal)).Err()
55 » » Reason("while filtering deps").Err()
56 if err != nil || len(fwdDeps) == 0 { 55 if err != nil || len(fwdDeps) == 0 {
57 return 56 return
58 } 57 }
59 58
60 logging.Fields{"aid": atmpt.ID, "count": len(fwdDeps)}.Infof(c, "added d eps") 59 logging.Fields{"aid": atmpt.ID, "count": len(fwdDeps)}.Infof(c, "added d eps")
61 atmpt.DepMap = bit_field.Make(uint32(len(fwdDeps))) 60 atmpt.DepMap = bit_field.Make(uint32(len(fwdDeps)))
62 61
63 for i, fdp := range fwdDeps { 62 for i, fdp := range fwdDeps {
64 fdp.BitIndex = uint32(i) 63 fdp.BitIndex = uint32(i)
65 fdp.ForExecution = atmpt.CurExecution 64 fdp.ForExecution = atmpt.CurExecution
66 } 65 }
67 66
68 if err = ds.Put(c, fwdDeps, atmpt, ex); err != nil { 67 if err = ds.Put(c, fwdDeps, atmpt, ex); err != nil {
69 » » err = errors.Annotate(err).Tag(grpcutil.Tag.With(codes.Internal) ). 68 » » err = errors.Annotate(err, "putting stuff").Tag(grpcutil.Tag.Wit h(codes.Internal)).Err()
70 » » » Reason("putting stuff").Err()
71 return 69 return
72 } 70 }
73 71
74 mergeQuestMap := map[string]*MergeQuest(nil) 72 mergeQuestMap := map[string]*MergeQuest(nil)
75 if len(a.Quests) > 0 { 73 if len(a.Quests) > 0 {
76 mergeQuestMap = make(map[string]*MergeQuest, len(a.Quests)) 74 mergeQuestMap = make(map[string]*MergeQuest, len(a.Quests))
77 for _, q := range a.Quests { 75 for _, q := range a.Quests {
78 mergeQuestMap[q.ID] = &MergeQuest{Quest: q} 76 mergeQuestMap[q.ID] = &MergeQuest{Quest: q}
79 } 77 }
80 } 78 }
(...skipping 25 matching lines...) Expand all
106 for _, mut := range mergeQuestMap { 104 for _, mut := range mergeQuestMap {
107 muts = append(muts, mut) 105 muts = append(muts, mut)
108 } 106 }
109 107
110 return 108 return
111 } 109 }
112 110
113 func init() { 111 func init() {
114 tumble.Register((*AddDeps)(nil)) 112 tumble.Register((*AddDeps)(nil))
115 } 113 }
OLDNEW
« no previous file with comments | « dm/appengine/distributor/swarming/v1/isolate.go ('k') | dm/appengine/mutate/finish_attempt.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698