Skip to content

Commit

Permalink
Increase verbosity of error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Jul 11, 2022
1 parent 66974fd commit 9b62517
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 3 additions & 3 deletions jsonrpc/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (s *Service) blockAtHash(ctx context.Context, hash string) (*spec.Block, er
var block spec.Block

if err := s.client.CallFor(&block, "eth_getBlockByHash", hash, true); err != nil {
return nil, err
return nil, errors.Wrap(err, fmt.Sprintf("eth_getBlockByHash for %#x failed", hash))
}

return &block, nil
Expand All @@ -53,11 +53,11 @@ func (s *Service) blockAtHeight(ctx context.Context, height int64) (*spec.Block,

if height == -1 {
if err := s.client.CallFor(&block, "eth_getBlockByNumber", "latest", true); err != nil {
return nil, err
return nil, errors.Wrap(err, "eth_getBlockByNumber for latest failed")
}
} else {
if err := s.client.CallFor(&block, "eth_getBlockByNumber", fmt.Sprintf("0x%x", height), true); err != nil {
return nil, err
return nil, errors.Wrap(err, fmt.Sprintf("eth_getBlockByNumber for 0x%x failed", height))
}
}

Expand Down
4 changes: 0 additions & 4 deletions jsonrpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ func New(ctx context.Context, params ...Parameter) (execclient.Service, error) {
// fetchStaticValues fetches values that never change.
// This caches the values, avoiding future API calls.
func (s *Service) fetchStaticValues(ctx context.Context) error {
if _, err := s.NetworkID(ctx); err != nil {
return errors.Wrap(err, "failed to fetch network ID")
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion spec/type0transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (t *Type0Transaction) unpack(data *type0TransactionJSON) error {
}
t.GasPrice, err = strconv.ParseUint(util.PreUnmarshalHexString(data.GasPrice), 16, 64)
if err != nil {
return errors.Wrap(err, "gas price invalid")
return errors.Wrap(err, fmt.Sprintf("gas price for %s invalid", data.Hash))
}

if data.Hash == "" {
Expand Down

0 comments on commit 9b62517

Please sign in to comment.