Skip to content

Commit

Permalink
Merge pull request #8 from gnosischain/more-context-on-errors
Browse files Browse the repository at this point in the history
add: more context on errors
  • Loading branch information
riccardo-gnosis authored Sep 19, 2024
2 parents 65fe652 + af3de4b commit a0b0798
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/clientapi/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s *APIClient) RequestBeaconBlock(slot phase0.Slot) (*local_spec.AgnosticBl

if errors.Is(err, context.DeadlineExceeded) {
ticker := time.NewTicker(utils.RoutineFlushTimeout)
log.Warnf("retrying request: %s", routineKey)
log.Warnf("retrying request for beacon block at slot %d: %s", slot, routineKey)
<-ticker.C
}
}
Expand Down Expand Up @@ -141,7 +141,7 @@ func (s *APIClient) CreateMissingBlock(slot phase0.Slot) *local_spec.AgnosticBlo
})
proposerValIdx := phase0.ValidatorIndex(0)
if err != nil {
log.Errorf("could not request proposer duty: %s", err)
log.Errorf("could not request proposer duty for slot %d: %s", slot, err)
} else {
for _, duty := range duties.Data {
if duty.Slot == phase0.Slot(slot) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/clientapi/rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (s *APIClient) RequestBlockRewards(slot phase0.Slot) (spec.BlockRewards, er
err = json.Unmarshal(body, &rewards)

if err != nil {
log.Warnf("error parsing block rewards response boyd %s: %s", string(body), err)
log.Warnf("error parsing block rewards for slot %d, response response body %s: %s", slot, string(body), err)
}

return rewards, err
Expand Down
10 changes: 5 additions & 5 deletions pkg/clientapi/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ func (s *APIClient) RequestBeaconState(slot phase0.Slot) (*local_spec.AgnosticSt
})

if newState == nil {
return nil, fmt.Errorf("unable to retrieve Beacon State from the beacon node, closing requester routine. nil State")
return nil, fmt.Errorf("unable to retrieve beacon state for slot %d from the beacon node, closing requester routine. nil State", slot)
}

if errors.Is(err, context.DeadlineExceeded) {
ticker := time.NewTicker(utils.RoutineFlushTimeout)
log.Warnf("retrying request: %s", routineKey)
log.Warnf("retrying request to retrieve beacon state for slot %d: %s", slot, routineKey)
<-ticker.C

}
Expand Down Expand Up @@ -74,9 +74,9 @@ func (s *APIClient) RequestStateRoot(slot phase0.Slot) *phase0.Root {
})
if err != nil {
if response404(err.Error()) {
log.Warningf("could not find the state root at %d: %s", slot, err)
log.Warningf("could not find the state root at slot %d: %s", slot, err)
} else {
log.Errorf("error for state root at %d: %s", slot, err)
log.Errorf("error for state root at slot %d: %s", slot, err)
}
} else {
return root.Data
Expand All @@ -95,7 +95,7 @@ func (s *APIClient) GetFinalizedEndSlotStateRoot() (phase0.Slot, *phase0.Root) {
})

if err != nil {
log.Panicf("could not determine the current finalized checkpoint")
log.Panicf("could not determine the current finalized checkpoint (head)")
}

finalizedSlot := phase0.Slot(currentFinalized.Data.Finalized.Epoch*local_spec.SlotsPerEpoch - 1)
Expand Down

0 comments on commit a0b0798

Please sign in to comment.