Skip to content

Commit

Permalink
fix err handling
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds committed Mar 15, 2024
1 parent 8e64f7c commit 4c4ec8d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions relayer/pkg/starknet/chain_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package starknet

import (
"context"
"fmt"

"github.com/NethermindEth/juno/core/felt"
starknetrpc "github.com/NethermindEth/starknet.go/rpc"
gethrpc "github.com/ethereum/go-ethereum/rpc"
"github.com/pkg/errors"
)

// type alias for readibility
Expand Down Expand Up @@ -47,13 +47,13 @@ func (c *Client) BlockByHash(ctx context.Context, h *felt.Felt) (FinalizedBlock,
block, err := c.Provider.BlockWithTxs(ctx, starknetrpc.BlockID{Hash: h})

if err != nil {
return FinalizedBlock{}, errors.Wrap(err, "error in BlockByHash")
return FinalizedBlock{}, fmt.Errorf("error in BlockByHash: %w", err)
}

finalizedBlock, ok := block.(*FinalizedBlock)

if !ok {
return FinalizedBlock{}, errors.Errorf("expected type Finalized block but found: %T", block)
return FinalizedBlock{}, fmt.Errorf("expected type Finalized block but found: %T", block)
}

return *finalizedBlock, nil
Expand Down

0 comments on commit 4c4ec8d

Please sign in to comment.