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

Side by Side Diff: dm/appengine/distributor/notify_execution.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/deps/util.go ('k') | dm/appengine/distributor/swarming/v1/distributor.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 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 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 distributor 5 package distributor
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/errors" 9 "github.com/luci/luci-go/common/errors"
10 "github.com/luci/luci-go/common/logging" 10 "github.com/luci/luci-go/common/logging"
(...skipping 22 matching lines...) Expand all
33 if err != nil { 33 if err != nil {
34 logging.Fields{ 34 logging.Fields{
35 logging.ErrorKey: err, 35 logging.ErrorKey: err,
36 "cfg": f.CfgName, 36 "cfg": f.CfgName,
37 }.Errorf(c, "Failed to make distributor") 37 }.Errorf(c, "Failed to make distributor")
38 return 38 return
39 } 39 }
40 40
41 q := &model.Quest{ID: f.Notification.ID.Quest} 41 q := &model.Quest{ID: f.Notification.ID.Quest}
42 if err := ds.Get(ds.WithoutTransaction(c), q); err != nil { 42 if err := ds.Get(ds.WithoutTransaction(c), q); err != nil {
43 » » return nil, errors.Annotate(err).Reason("getting Quest").Err() 43 » » return nil, errors.Annotate(err, "getting Quest").Err()
44 } 44 }
45 rslt, err := dist.HandleNotification(&q.Desc, f.Notification) 45 rslt, err := dist.HandleNotification(&q.Desc, f.Notification)
46 if err != nil { 46 if err != nil {
47 // TODO(riannucci): check for transient/non-transient 47 // TODO(riannucci): check for transient/non-transient
48 logging.Fields{ 48 logging.Fields{
49 logging.ErrorKey: err, 49 logging.ErrorKey: err,
50 "cfg": f.CfgName, 50 "cfg": f.CfgName,
51 }.Errorf(c, "Failed to handle notification") 51 }.Errorf(c, "Failed to handle notification")
52 return 52 return
53 } 53 }
54 if rslt != nil { 54 if rslt != nil {
55 return reg.FinishExecution(c, f.Notification.ID, rslt) 55 return reg.FinishExecution(c, f.Notification.ID, rslt)
56 } 56 }
57 return 57 return
58 } 58 }
59 59
60 func init() { 60 func init() {
61 tumble.Register((*NotifyExecution)(nil)) 61 tumble.Register((*NotifyExecution)(nil))
62 } 62 }
OLDNEW
« no previous file with comments | « dm/appengine/deps/util.go ('k') | dm/appengine/distributor/swarming/v1/distributor.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698