1
0
Fork 0

fixed clumsy error handling

This commit is contained in:
Jan Steemann 2014-10-24 10:29:13 +02:00
parent b3d57d0330
commit 699517413e
3 changed files with 14 additions and 3 deletions

View File

@ -656,7 +656,7 @@ UNITTESTS_SERVER_AQL = $(addprefix --javascript.unit-tests ,$(SHELL_SERVER_AQL))
unittests-shell-server-aql:
@echo
@echo "================================================================================"
@echo "<< SHELL SERVER TESTS (AQL) >>"
@echo "<< SHELL SERVER TESTS (AQL) >>"
@echo "================================================================================"
@echo

View File

@ -407,11 +407,11 @@ AstNode* Ast::createNodeVariable (char const* name,
////////////////////////////////////////////////////////////////////////////////
AstNode* Ast::createNodeCollection (char const* name) {
if (name == nullptr || *name == '\0') {
if (name == nullptr) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
}
if (! TRI_IsAllowedNameCollection(true, name)) {
if (*name == '\0' || ! TRI_IsAllowedNameCollection(true, name)) {
_query->registerError(TRI_ERROR_ARANGO_ILLEGAL_NAME, name);
return nullptr;
}

View File

@ -600,6 +600,17 @@ ExecutionNode* ExecutionPlan::fromNodeLimit (ExecutionNode* previous,
TRI_ASSERT(offset->type == NODE_TYPE_VALUE);
TRI_ASSERT(count->type == NODE_TYPE_VALUE);
if ((offset->value.type != VALUE_TYPE_INT &&
offset->value.type != VALUE_TYPE_DOUBLE) ||
offset->getIntValue() < 0) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, "LIMIT value is not a number or out of range");
}
if ((count->value.type != VALUE_TYPE_INT &&
count->value.type != VALUE_TYPE_DOUBLE) ||
count->getIntValue() < 0) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, "LIMIT value is not a number or out of range");
}
auto en = registerNode(new LimitNode(this, nextId(), static_cast<size_t>(offset->getIntValue()), static_cast<size_t>(count->getIntValue())));