diff --git a/arangod/Aql/ExecutionBlock.h b/arangod/Aql/ExecutionBlock.h index fac2afa890..c5633a2e0d 100644 --- a/arangod/Aql/ExecutionBlock.h +++ b/arangod/Aql/ExecutionBlock.h @@ -189,12 +189,11 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// ExecutionBlock* operator[] (size_t pos) { - if (pos > _dependencies.size()) { + if (pos >= _dependencies.size()) { return nullptr; } - else { - return _dependencies.at(pos); - } + + return _dependencies.at(pos); } //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/Aql/ExecutionNode.h b/arangod/Aql/ExecutionNode.h index 7b5673bb93..6fc667a4b7 100644 --- a/arangod/Aql/ExecutionNode.h +++ b/arangod/Aql/ExecutionNode.h @@ -172,12 +172,11 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// ExecutionNode* operator[] (size_t pos) const { - if (pos > _dependencies.size()) { + if (pos >= _dependencies.size()) { return nullptr; } - else { - return _dependencies.at(pos); - } + + return _dependencies.at(pos); } //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index 881e55c02a..d56f47a349 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -238,9 +238,15 @@ QueryResult Query::execute () { catch (triagens::arango::Exception const& ex) { return QueryResult(ex.code(), ex.message()); } - catch (...) { + catch (std::bad_alloc const& ex) { return QueryResult(TRI_ERROR_OUT_OF_MEMORY, TRI_errno_string(TRI_ERROR_OUT_OF_MEMORY)); } + catch (std::exception const& ex) { + return QueryResult(TRI_ERROR_INTERNAL, ex.what()); + } + catch (...) { + return QueryResult(TRI_ERROR_INTERNAL, TRI_errno_string(TRI_ERROR_INTERNAL)); + } } ////////////////////////////////////////////////////////////////////////////////