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

Side by Side Diff: logdog/common/storage/entry.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
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 storage 5 package storage
6 6
7 import ( 7 import (
8 "github.com/luci/luci-go/common/errors" 8 "github.com/luci/luci-go/common/errors"
9 "github.com/luci/luci-go/logdog/api/logpb" 9 "github.com/luci/luci-go/logdog/api/logpb"
10 "github.com/luci/luci-go/logdog/common/types" 10 "github.com/luci/luci-go/logdog/common/types"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // underlying data. 61 // underlying data.
62 func (e *Entry) GetLogEntry() (*logpb.LogEntry, error) { 62 func (e *Entry) GetLogEntry() (*logpb.LogEntry, error) {
63 if e.le == nil { 63 if e.le == nil {
64 if e.D == nil { 64 if e.D == nil {
65 // This can happen with keys-only results. 65 // This can happen with keys-only results.
66 return nil, errors.New("no log entry data") 66 return nil, errors.New("no log entry data")
67 } 67 }
68 68
69 var le logpb.LogEntry 69 var le logpb.LogEntry
70 if err := proto.Unmarshal(e.D, &le); err != nil { 70 if err := proto.Unmarshal(e.D, &le); err != nil {
71 » » » return nil, errors.Annotate(err).Reason("failed to unmar shal").Err() 71 » » » return nil, errors.Annotate(err, "failed to unmarshal"). Err()
72 } 72 }
73 e.le = &le 73 e.le = &le
74 } 74 }
75 75
76 return e.le, nil 76 return e.le, nil
77 } 77 }
OLDNEW
« no previous file with comments | « logdog/common/storage/bigtable/logdog_bigtable_test/main.go ('k') | logdog/common/types/streamaddr.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698