Skip to content

Commit

Permalink
add internal error check
Browse files Browse the repository at this point in the history
  • Loading branch information
weiihann committed Nov 5, 2024
1 parent 3e3564b commit 592eb95
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rpc/contract.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package rpc

import (
"errors"

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/juno/db"
"github.com/NethermindEth/juno/jsonrpc"
)

Expand Down Expand Up @@ -43,7 +46,11 @@ func (h *Handler) StorageAt(address, key felt.Felt, id BlockID) (*felt.Felt, *js
// the returned value is always zero and error is nil.
_, err := stateReader.ContractNonce(&address)
if err != nil {
return nil, ErrContractNotFound
if errors.Is(err, db.ErrKeyNotFound) {
return nil, ErrContractNotFound
}
h.log.Errorw("Failed to get contract nonce", "err", err)
return nil, ErrInternal
}

value, err := stateReader.ContractStorage(&address, &key)
Expand Down

0 comments on commit 592eb95

Please sign in to comment.