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

Side by Side Diff: logdog/server/archivist/archivist.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 | « logdog/common/types/streamaddr.go ('k') | logdog/server/service/config/poller.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 archivist 5 package archivist
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "encoding/hex" 9 "encoding/hex"
10 "fmt" 10 "fmt"
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 Project: sa.project, 531 Project: sa.project,
532 Path: sa.path, 532 Path: sa.path,
533 KeysOnly: true, 533 KeysOnly: true,
534 } 534 }
535 535
536 nextIndex := types.MessageIndex(0) 536 nextIndex := types.MessageIndex(0)
537 var ierr error 537 var ierr error
538 err := sa.Storage.Get(sreq, func(e *storage.Entry) bool { 538 err := sa.Storage.Get(sreq, func(e *storage.Entry) bool {
539 idx, err := e.GetStreamIndex() 539 idx, err := e.GetStreamIndex()
540 if err != nil { 540 if err != nil {
541 » » » ierr = errors.Annotate(err).Reason("could not get stream index").Err() 541 » » » ierr = errors.Annotate(err, "could not get stream index" ).Err()
542 return false 542 return false
543 } 543 }
544 544
545 switch { 545 switch {
546 case idx != nextIndex: 546 case idx != nextIndex:
547 ierr = fmt.Errorf("missing log entry index %d (next %d)" , nextIndex, idx) 547 ierr = fmt.Errorf("missing log entry index %d (next %d)" , nextIndex, idx)
548 return false 548 return false
549 549
550 case idx == sa.terminalIndex: 550 case idx == sa.terminalIndex:
551 // We have hit our terminal index, so all of the log dat a is here! 551 // We have hit our terminal index, so all of the log dat a is here!
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 return e.inner 800 return e.inner
801 } 801 }
802 802
803 func isFailure(err error) bool { 803 func isFailure(err error) bool {
804 if err == nil { 804 if err == nil {
805 return false 805 return false
806 } 806 }
807 _, ok := err.(*statusErrorWrapper) 807 _, ok := err.(*statusErrorWrapper)
808 return !ok 808 return !ok
809 } 809 }
OLDNEW
« no previous file with comments | « logdog/common/types/streamaddr.go ('k') | logdog/server/service/config/poller.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698