Skip to content

fix: added fix for varible value not found #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
7 changes: 4 additions & 3 deletions variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ func (vr *variableResolver) resolve(ctx *ExecutionContext) (*Value, error) {

if !current.IsValid() {
// Value is not valid (anymore)
return AsValue(nil), nil
return AsValue("NOT FOUND"), fmt.Errorf("No value found for %s", vr)

}

// If current is a reflect.ValueOf(pongo2.Value), then unpack it
Expand Down Expand Up @@ -509,7 +510,7 @@ func (vr *variableResolver) resolve(ctx *ExecutionContext) (*Value, error) {

if !current.IsValid() {
// Value is not valid (e. g. NIL value)
return AsValue(nil), nil
return AsValue("NOT FOUND"), fmt.Errorf("No value found for %s", vr)
}
}

Expand Down Expand Up @@ -659,7 +660,7 @@ func (p *Parser) parseVariableOrLiteral() (IEvaluator, *Error) {
return br, nil
default:
return nil, p.Error(fmt.Errorf("This keyword is not allowed here."), nil)
<

}
case TokenSymbol:
if t.Val == "[" {
Expand Down