Skip to content

Commit

Permalink
better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
billettc committed Feb 2, 2024
1 parent 80f51df commit 3de1bf8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions block/fetcher/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ func (f *RPCFetcher) Fetch(ctx context.Context, requestedSlot uint64) (out *pbbs
return nil, true, nil
}

if blockResult == nil {
panic("blockResult is nil and skip is false. This should not happen.")
}

block, err := blockFromBlockResult(requestedSlot, f.latestFinalizedSlot, blockResult, f.logger)
if err != nil {
return nil, false, fmt.Errorf("decoding block %d: %w", requestedSlot, err)
Expand Down Expand Up @@ -136,6 +140,10 @@ func (f *RPCFetcher) fetch(ctx context.Context, requestedSlot uint64) (*rpc.GetB
}
return nil
})

if err != nil {
return nil, false, fmt.Errorf("after retrying fetch block %d: %w", requestedSlot, err)
}
return out, skipped, err
}

Expand Down

0 comments on commit 3de1bf8

Please sign in to comment.