1
0
Fork 0

improve error messages when trying to create indices

This commit is contained in:
Wilfried Goesgens 2017-03-06 19:10:46 +01:00
parent 8a79e5fed4
commit a7e154b27e
1 changed files with 7 additions and 5 deletions

View File

@ -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 [*] "