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