Skip to content

Commit

Permalink
gc: tweak names of error classes
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Kevin Atkinson <[email protected]>
  • Loading branch information
kevina committed Feb 24, 2017
1 parent aeb42fa commit 4a71e51
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pin/gc/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func GC(ctx context.Context, bs bstore.GCBlockstore, ls dag.LinkService, pn pin.
err := bs.DeleteBlock(k)
if err != nil {
errors = true
output <- Result{Error: &CouldNotDeleteBlockError{k, err}}
output <- Result{Error: &ErrCouldNotDeleteBlock{k, err}}
//log.Debugf("Error removing key from blockstore: %s", err)
// continue as error is non-fatal
continue loop
Expand Down Expand Up @@ -112,7 +112,7 @@ func ColoredSet(ctx context.Context, pn pin.Pinner, ls dag.LinkService, bestEffo
links, err := ls.GetLinks(ctx, cid)
if err != nil {
errors = true
output <- Result{Error: &CouldNotFetchLinksError{cid, err}}
output <- Result{Error: &ErrCouldNotFetchLinks{cid, err}}
}
return links, nil
}
Expand All @@ -126,7 +126,7 @@ func ColoredSet(ctx context.Context, pn pin.Pinner, ls dag.LinkService, bestEffo
links, err := ls.GetLinks(ctx, cid)
if err != nil && err != dag.ErrNotFound {
errors = true
output <- Result{Error: &CouldNotFetchLinksError{cid, err}}
output <- Result{Error: &ErrCouldNotFetchLinks{cid, err}}
}
return links, nil
}
Expand Down Expand Up @@ -157,20 +157,20 @@ var ErrCoundNotFetchAllLinks = errors.New("garbage collection aborted: could not

var ErrCouldNotDeleteSomeBlocks = errors.New("garbage collection incomplete: could not delete some blocks")

type CouldNotFetchLinksError struct {
type ErrCouldNotFetchLinks struct {
Key *cid.Cid
Err error
}

func (e *CouldNotFetchLinksError) Error() string {
func (e *ErrCouldNotFetchLinks) Error() string {
return fmt.Sprintf("could not retrieve links for %s: %s", e.Key, e.Err)
}

type CouldNotDeleteBlockError struct {
type ErrCouldNotDeleteBlock struct {
Key *cid.Cid
Err error
}

func (e *CouldNotDeleteBlockError) Error() string {
func (e *ErrCouldNotDeleteBlock) Error() string {
return fmt.Sprintf("could not remove %s: %s", e.Key, e.Err)
}

0 comments on commit 4a71e51

Please sign in to comment.