From a7e154b27e43ee67cac37fb064fd9d51ead1a9d4 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Mon, 6 Mar 2017 19:10:46 +0100 Subject: [PATCH] improve error messages when trying to create indices --- lib/Basics/AttributeNameParser.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Basics/AttributeNameParser.cpp b/lib/Basics/AttributeNameParser.cpp index ff03fa651f..278988be78 100644 --- a/lib/Basics/AttributeNameParser.cpp +++ b/lib/Basics/AttributeNameParser.cpp @@ -121,16 +121,18 @@ void arangodb::basics::TRI_ParseAttributeString( for (size_t pos = 0; pos < length; ++pos) { auto token = input[pos]; if (token == '[') { - // We only allow attr[*] and attr[*].attr2 as valid patterns - if (length - pos < 3 || input[pos + 1] != '*' || input[pos + 2] != ']' || - (length - pos > 3 && input[pos + 3] != '.')) { - THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED); - } if (!allowExpansion) { THROW_ARANGO_EXCEPTION_MESSAGE( TRI_ERROR_BAD_PARAMETER, "cannot use [*] expansion for this type of index"); } + // We only allow attr[*] and attr[*].attr2 as valid patterns + if (length - pos < 3 || input[pos + 1] != '*' || input[pos + 2] != ']' || + (length - pos > 3 && input[pos + 3] != '.')) { + THROW_ARANGO_EXCEPTION_MESSAGE( + TRI_ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED, + "can only use [*] for indexes"); + } if (foundExpansion) { THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "cannot use multiple [*] "