mirror of https://gitee.com/bigwinds/arangodb
improve error messages when trying to create indices
This commit is contained in:
parent
8a79e5fed4
commit
a7e154b27e
|
@ -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 [*] "
|
||||
|
|
Loading…
Reference in New Issue