diff --git a/arangod/Aql/IndexNode.cpp b/arangod/Aql/IndexNode.cpp index 95597ef503..bf02d098c5 100644 --- a/arangod/Aql/IndexNode.cpp +++ b/arangod/Aql/IndexNode.cpp @@ -70,13 +70,13 @@ IndexNode::IndexNode(ExecutionPlan* plan, arangodb::velocypack::Slice const& bas std::string msg("collection '"); msg.append(base.get("collection").copyString()); msg.append("' not found"); - THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, msg); + THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, msg); } VPackSlice indexes = base.get("indexes"); if (!indexes.isArray()) { - THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "\"indexes\" attribute should be an array"); + THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "\"indexes\" attribute should be an array"); } _indexes.reserve(indexes.length()); @@ -89,7 +89,7 @@ IndexNode::IndexNode(ExecutionPlan* plan, arangodb::velocypack::Slice const& bas VPackSlice condition = base.get("condition"); if (!condition.isObject()) { - THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "\"condition\" attribute should be an object"); + THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "\"condition\" attribute should be an object"); } _condition = Condition::fromVPack(plan, condition); diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index 19501ebbcd..3d61609923 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -470,7 +470,7 @@ ExecutionPlan* Query::prepare() { enterState(QueryExecutionState::ValueType::PLAN_INSTANTIATION); plan.reset(ExecutionPlan::instantiateFromAst(_ast.get())); - if (plan.get() == nullptr) { + if (plan == nullptr) { // oops THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "failed to create query execution engine"); } @@ -507,7 +507,7 @@ ExecutionPlan* Query::prepare() { // we have an execution plan in VelocyPack format plan.reset(ExecutionPlan::instantiateFromVelocyPack(_ast.get(), _queryBuilder->slice())); - if (plan.get() == nullptr) { + if (plan == nullptr) { // oops THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "could not create plan from vpack"); } @@ -980,7 +980,7 @@ QueryResult Query::explain() { if (plan == nullptr) { // oops - return QueryResult(TRI_ERROR_INTERNAL); + return QueryResult(TRI_ERROR_INTERNAL, "unable to create plan from AST"); } // Run the query optimizer: @@ -1074,8 +1074,8 @@ void Query::enterContext() { _context = V8DealerFeature::DEALER->enterContext(_vocbase, false); if (_context == nullptr) { - THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, - "cannot enter V8 context"); + THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_RESOURCE_LIMIT, + "unable to enter V8 context for query execution"); } // register transaction and resolver in context diff --git a/arangod/Aql/V8Executor.cpp b/arangod/Aql/V8Executor.cpp index 27d755e62e..0950d8a536 100644 --- a/arangod/Aql/V8Executor.cpp +++ b/arangod/Aql/V8Executor.cpp @@ -359,7 +359,7 @@ void V8Executor::HandleV8Error(v8::TryCatch& tryCatch, msg += " See log for details"; } // we can't figure out what kind of error occurred and throw a generic error - THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, msg); + THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_SCRIPT, msg); } if (result.IsEmpty()) { @@ -373,7 +373,7 @@ void V8Executor::HandleV8Error(v8::TryCatch& tryCatch, msg += " See log for details"; } - THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, msg); + THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_SCRIPT, msg); } // if we get here, no exception has been raised diff --git a/arangod/RestHandler/RestBatchHandler.cpp b/arangod/RestHandler/RestBatchHandler.cpp index e669bc30d3..9feddb76d7 100644 --- a/arangod/RestHandler/RestBatchHandler.cpp +++ b/arangod/RestHandler/RestBatchHandler.cpp @@ -30,6 +30,7 @@ #include "GeneralServer/RestHandlerFactory.h" #include "Logger/Logger.h" #include "Rest/HttpRequest.h" +#include "Utils/ExecContext.h" using namespace arangodb; using namespace arangodb::basics; @@ -212,19 +213,14 @@ RestStatus RestBatchHandler::executeHttp() { { // ignore any errors here, will be handled later by inspecting the response try { + ExecContext* old = ExecContext::CURRENT; + ExecContext::CURRENT = nullptr; + + TRI_DEFER(ExecContext::CURRENT = old); handler->syncRunEngine(); } catch (...) { } -#if 0 - int result = TRI_ERROR_NO_ERROR; - if (result != TRI_ERROR_NO_ERROR) { - generateError(rest::ResponseCode::BAD, TRI_ERROR_INTERNAL, - "executing a handler for batch part failed"); - - return RestStatus::FAIL; - } -#endif HttpResponse* partResponse = dynamic_cast(handler->response()); diff --git a/arangod/RestHandler/RestExplainHandler.cpp b/arangod/RestHandler/RestExplainHandler.cpp index c11c8f71ed..016919a1d0 100644 --- a/arangod/RestHandler/RestExplainHandler.cpp +++ b/arangod/RestHandler/RestExplainHandler.cpp @@ -82,7 +82,7 @@ void RestExplainHandler::explainQuery() { generateError(rest::ResponseCode::BAD, TRI_ERROR_BAD_PARAMETER, msg); }; - if (!body.isObject() || body.length() < 1 || body.length() > 3) { + if (!body.isObject()) { badParamError( "expected usage: AQL_EXPLAIN(, , " ")"); diff --git a/js/server/modules/@arangodb/cluster.js b/js/server/modules/@arangodb/cluster.js index 6f4d506c98..a016715566 100644 --- a/js/server/modules/@arangodb/cluster.js +++ b/js/server/modules/@arangodb/cluster.js @@ -597,7 +597,7 @@ function synchronizeOneShard (database, shard, planId, leader) { try { ok = addShardFollower(ep, database, shard, lockJobId); } catch (err4) { - db._drop(shard); + db._drop(shard, {isSystem: true }); throw err4; } } catch (err3) { @@ -1001,7 +1001,7 @@ function executePlanForCollections(plannedCollections) { collections[collection].planId); try { - db._drop(collection, {timeout:1.0}); + db._drop(collection, {timeout:1.0, isSystem: true}); console.topic('heartbeat=debug', "dropping local shard '%s/%s' of '%s/%s => SUCCESS", database, collection,