mirror of
https://github.com/MontFerret/ferret.git
synced 2025-11-06 08:39:09 +02:00
Added panic recovery mechanism (#158)
This commit is contained in:
@@ -59,9 +59,6 @@ func (c *FqlCompiler) Compile(query string) (program *runtime.Program, err error
|
||||
return nil, ErrEmptyQuery
|
||||
}
|
||||
|
||||
p := parser.New(query)
|
||||
p.AddErrorListener(&errorListener{})
|
||||
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
// find out exactly what the error was and set err
|
||||
@@ -78,6 +75,9 @@ func (c *FqlCompiler) Compile(query string) (program *runtime.Program, err error
|
||||
}
|
||||
}()
|
||||
|
||||
p := parser.New(query)
|
||||
p.AddErrorListener(&errorListener{})
|
||||
|
||||
l := newVisitor(query, c.funcs)
|
||||
|
||||
res := p.Visit(l).(*result)
|
||||
|
||||
Reference in New Issue
Block a user