Skip to content

Commit

Permalink
chore: improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vgonkivs committed Jun 28, 2022
1 parent e0bc1fd commit 949c751
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions service/share/full_availability.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ func (fa *fullAvailability) SharesAvailable(ctx context.Context, root *Root) err
_, err := fa.rtrv.Retrieve(ctx, root)
if err != nil {
log.Errorw("availability validation failed", "root", root.Hash(), "err", err)
var notFound *format.ErrNotFound
if errors.As(err, &notFound) || errors.Is(err, context.DeadlineExceeded) {
if format.IsNotFound(err) || errors.Is(err, context.DeadlineExceeded) {
return ErrNotAvailable
}

Expand Down
3 changes: 1 addition & 2 deletions service/share/light_availability.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ func (la *lightAvailability) SharesAvailable(ctx context.Context, dah *Root) err
if !errors.Is(err, context.Canceled) {
log.Errorw("availability validation failed", "root", dah.Hash(), "err", err)
}
var notFound *format.ErrNotFound
if errors.As(err, &notFound) || errors.Is(err, context.DeadlineExceeded) {
if format.IsNotFound(err) || errors.Is(err, context.DeadlineExceeded) {
return ErrNotAvailable
}

Expand Down

0 comments on commit 949c751

Please sign in to comment.