Skip to content

Commit

Permalink
Use UnreachableError in panic
Browse files Browse the repository at this point in the history
Co-authored-by: Bastian Müller <bastian@turbolent.com>
  • Loading branch information
fxamacker and turbolent committed Oct 19, 2023
1 parent ca1a9ea commit bc7b622
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions runtime/cmd/decode-state-values/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/schollz/progressbar/v3"

"github.com/onflow/cadence/runtime/common"
runtimeErr "github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/runtime/interpreter"
)

Expand Down Expand Up @@ -91,8 +92,8 @@ func storageKeyToSlabID(address atree.Address, key string) atree.SlabID {
return atree.NewSlabID(address, index)
}

func decodeStorable(decoder *cbor.StreamDecoder, storableSlabStorageID atree.SlabID, inlnedExtraData []atree.ExtraData) (atree.Storable, error) {
return interpreter.DecodeStorable(decoder, storableSlabStorageID, inlnedExtraData, nil)
func decodeStorable(decoder *cbor.StreamDecoder, storableSlabStorageID atree.SlabID, inlinedExtraData []atree.ExtraData) (atree.Storable, error) {
return interpreter.DecodeStorable(decoder, storableSlabStorageID, inlinedExtraData, nil)
}

func decodeTypeInfo(decoder *cbor.StreamDecoder) (atree.TypeInfo, error) {
Expand Down Expand Up @@ -138,7 +139,7 @@ var _ atree.SlabStorage = &slabStorage{}

func (s *slabStorage) RetrieveIfLoaded(atree.SlabID) atree.Slab {
// RetrieveIfLoaded() is used for loaded resource tracking. So it isn't needed here.
panic("not reachable")
panic(runtimeErr.NewUnreachableError())
}

func (s *slabStorage) Retrieve(id atree.SlabID) (atree.Slab, bool, error) {
Expand Down

0 comments on commit bc7b622

Please sign in to comment.