Skip to content

Commit

Permalink
not panic
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterDY committed May 24, 2024
1 parent 71deb7b commit 3891179
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ast/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
package ast

import (
`github.com/bytedance/sonic/internal/rt`
`github.com/bytedance/sonic/internal/native/types`
"errors"

"github.com/bytedance/sonic/internal/native/types"
"github.com/bytedance/sonic/internal/rt"
)

type Searcher struct {
Expand Down Expand Up @@ -59,7 +61,7 @@ func (self *Searcher) getByPath(copystring bool, path ...interface{}) (Node, err
return Node{}, ErrNotExist
}
if err == types.ERR_UNSUPPORT_TYPE {
panic("path must be either int(>=0) or string")
return Node{}, errors.New("path must be either int(>=0) or string")
}
return Node{}, self.parser.syntaxError(err)
}
Expand Down

0 comments on commit 3891179

Please sign in to comment.