Skip to content

Commit

Permalink
Handle cast error
Browse files Browse the repository at this point in the history
  • Loading branch information
pefontana committed Sep 19, 2023
1 parent 36a071c commit 9273a1d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/hints/usort_hints.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ package hints
import (
"github.com/lambdaclass/cairo-vm.go/pkg/lambdaworks"
"github.com/lambdaclass/cairo-vm.go/pkg/types"
"github.com/pkg/errors"
)

// Implements hint:
// %{ vm_enter_scope(dict(__usort_max_size = globals().get('__usort_max_size'))) %}
func usort_enter_scope(executionScopes *types.ExecutionScopes) error {
usort_max_size, err := executionScopes.Get("usort_max_size")

usort_max_size_felt := usort_max_size.(lambdaworks.Felt)
usort_max_size_felt, cast_ok := usort_max_size.(lambdaworks.Felt)

if !cast_ok {
return errors.New("Error casting usort_max_size into a Felt")
}

if err != nil {
return err
Expand Down

0 comments on commit 9273a1d

Please sign in to comment.