From 83fbc1b7684c3e5fa4b8f88ecb2d2ed060f31a95 Mon Sep 17 00:00:00 2001 From: Ahsan Barkati Date: Thu, 11 Mar 2021 11:53:54 +0530 Subject: [PATCH] Fix(dql): Fix error message in case of wrong argument to val() (#7543) 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. --- gql/parser.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gql/parser.go b/gql/parser.go index 9574886fa82..a1e11cdd5ef 100644 --- a/gql/parser.go +++ b/gql/parser.go @@ -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{ @@ -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