Skip to content

Commit

Permalink
Fix(dql): Fix error message in case of wrong argument to val() (#7543)
Browse files Browse the repository at this point in the history
Fix wrong error message for DQL queries which contains a
val() function and val's argument is not a variable. It used to 
always say that it expects a variable but got comma. Fixed it
to spit the right error message.
  • Loading branch information
ahsanbarkati authored Mar 11, 2021
1 parent 195f247 commit a88ae81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gql/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2407,7 +2407,7 @@ loop:
expectArg = true
case itemName:
if !expectArg {
return count, item.Errorf("Expected a variable but got comma")
return count, item.Errorf("Expected a variable but got %s", item.Val)
}
count++
gq.NeedsVar = append(gq.NeedsVar, VarContext{
Expand Down Expand Up @@ -2440,7 +2440,7 @@ loop:
expectArg = true
case itemName:
if !expectArg {
return item.Errorf("Expected a variable but got comma")
return item.Errorf("Expected a variable but got %s", item.Val)
}
typeList = fmt.Sprintf("%s,%s", typeList, item.Val)
expectArg = false
Expand Down

0 comments on commit a88ae81

Please sign in to comment.