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

Side by Side Diff: dm/appengine/mutate/finish_attempt.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 mutate 5 package mutate
6 6
7 import ( 7 import (
8 "google.golang.org/grpc/codes" 8 "google.golang.org/grpc/codes"
9 9
10 ds "github.com/luci/gae/service/datastore" 10 ds "github.com/luci/gae/service/datastore"
11 "github.com/luci/luci-go/common/errors"
11 "github.com/luci/luci-go/common/logging" 12 "github.com/luci/luci-go/common/logging"
12 dm "github.com/luci/luci-go/dm/api/service/v1" 13 dm "github.com/luci/luci-go/dm/api/service/v1"
13 "github.com/luci/luci-go/dm/appengine/model" 14 "github.com/luci/luci-go/dm/appengine/model"
14 "github.com/luci/luci-go/grpc/grpcutil" 15 "github.com/luci/luci-go/grpc/grpcutil"
15 "github.com/luci/luci-go/tumble" 16 "github.com/luci/luci-go/tumble"
16 "golang.org/x/net/context" 17 "golang.org/x/net/context"
17 ) 18 )
18 19
19 // FinishAttempt does a couple things: 20 // FinishAttempt does a couple things:
20 // Invalidates the current Execution 21 // Invalidates the current Execution
(...skipping 26 matching lines...) Expand all
47 48
48 ar := &model.AttemptResult{ 49 ar := &model.AttemptResult{
49 Attempt: model.AttemptKeyFromID(c, &atmpt.ID), 50 Attempt: model.AttemptKeyFromID(c, &atmpt.ID),
50 Data: *f.Data, 51 Data: *f.Data,
51 } 52 }
52 53
53 rslt := *f.Data 54 rslt := *f.Data
54 atmpt.Result.Data = &rslt 55 atmpt.Result.Data = &rslt
55 atmpt.Result.Data.Object = "" 56 atmpt.Result.Data.Object = ""
56 57
57 » err = grpcutil.Annotate(ds.Put(c, atmpt, ar), codes.Internal).Reason("du ring Put").Err() 58 » err = errors.Annotate(ds.Put(c, atmpt, ar)).Tag(grpcutil.Tag.With(codes. Internal)).
59 » » Reason("during Put").Err()
58 return 60 return
59 } 61 }
60 62
61 func init() { 63 func init() {
62 tumble.Register((*FinishAttempt)(nil)) 64 tumble.Register((*FinishAttempt)(nil))
63 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698