Skip to content

Commit

Permalink
better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregor Gololicic committed Feb 21, 2024
1 parent 9d5b7dc commit ba0a059
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (b *BlockChainAPI) GetTransactionReceipt(
return nil, errs.ErrInternal
}

return nil, err
return nil, fmt.Errorf("failed to get transaction receipt: %w", err)
}

return rcp, nil
Expand Down
9 changes: 7 additions & 2 deletions storage/pebble/receipts.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ func (r *Receipts) GetByTransactionID(ID common.Hash) (*gethTypes.Receipt, error

height, err := r.store.get(receiptTxIDToHeightKey, ID.Bytes())
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to get receipt by tx ID: %w", err)
}

rcp, err := r.getByBlockHeight(height)
if err != nil {
return nil, fmt.Errorf("failed to get receipt by height: %w", err)
}

return r.getByBlockHeight(height)
return rcp, nil
}

func (r *Receipts) GetByBlockHeight(height *big.Int) (*gethTypes.Receipt, error) {
Expand Down

0 comments on commit ba0a059

Please sign in to comment.