8000 improve debug messages · surajpatel11/arangodb@4ab4d7d · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ab4d7d

Browse files
committed
improve debug messages
1 parent e917deb commit 4ab4d7d

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

arangod/Aql/RestAqlHandler.cpp

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ void RestAqlHandler::createQueryFromVelocyPack() {
395395
bool success = false;
396396
VPackSlice querySlice = this->parseVPackBody(success);
397397
if (!success) {
398-
LOG_TOPIC(ERR, arangodb::Logger::FIXME)
398+
LOG_TOPIC(ERR, arangodb::Logger::AQL)
399399
<< "invalid VelocyPack plan in query";
400400
return;
401401
}
@@ -404,7 +404,7 @@ void RestAqlHandler::createQueryFromVelocyPack() {
404404

405405
VPackSlice plan = querySlice.get("plan");
406406
if (plan.isNone()) {
407-
LOG_TOPIC(ERR, arangodb::Logger::FIXME)
407+
LOG_TOPIC(ERR, arangodb::Logger::AQL)
408408
<< "Invalid VelocyPack: \"plan\" attribute missing.";
409409
generateError(rest::ResponseCode::BAD, TRI_ERROR_INTERNAL,
410410
"body must be an object with attribute \"plan\"");
@@ -429,13 +429,13 @@ void RestAqlHandler::createQueryFromVelocyPack() {
429429
try {
430430
query->prepare(_queryRegistry);
431431
} catch (std::exception const& ex) {
432-
LOG_TOPIC(ERR, arangodb::Logger::FIXME)
432+
LOG_TOPIC(ERR, arangodb::Logger::AQL)
433433
<< "failed to instantiate the query: " << ex.what();
434434
generateError(rest::ResponseCode::BAD, TRI_ERROR_QUERY_BAD_JSON_PLAN,
435435
ex.what());
436436
return;
437437
} catch (...) {
438-
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "failed to instantiate the query";
438+
LOG_TOPIC(ERR, arangodb::Logger::AQL) << "failed to instantiate the query";
439439
generateError(rest::ResponseCode::BAD, TRI_ERROR_QUERY_BAD_JSON_PLAN, "failed to instantiate the query");
440440
return;
441441
}
@@ -448,7 +448,7 @@ void RestAqlHandler::createQueryFromVelocyPack() {
448448
_queryRegistry->insert(_qId, query.get(), ttl, true, false);
449449
query.release();
450450
} catch (...) {
451-
LOG_TOPIC(ERR, arangodb::Logger::FIXME)
451+
LOG_TOPIC(ERR, arangodb::Logger::AQL)
452452
<< "could not keep query in registry";
453453
generateError(rest::ResponseCode::BAD, TRI_ERROR_INTERNAL, "could not insert query into registry");
454454
return;
@@ -532,13 +532,13 @@ RestStatus RestAqlHandler::useQuery(std::string const& operation,
532532
} catch (arangodb::basics::Exception const& ex) {
533533
generateError(rest::ResponseCode::SERVER_ERROR, ex.code(), ex.what());
534534
} catch (std::exception const& ex) {
535-
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "failed during use of Query: "
536-
<< ex.what();
535+
LOG_TOPIC(ERR, arangodb::Logger::AQL) << "failed during use of Query: "
536+
<< ex.what();
537537

538538
generateError(rest::ResponseCode::SERVER_ERROR, TRI_ERROR_HTTP_SERVER_ERROR,
539539
ex.what());
540540
} catch (...) {
541-
LOG_TOPIC(ERR, arangodb::Logger::FIXME)
541+
LOG_TOPIC(ERR, arangodb::Logger::AQL)
542542
<< "failed during use of Query: Unknown exception occurred";
543543

544544
generateError(rest::ResponseCode::SERVER_ERROR, TRI_ERROR_HTTP_SERVER_ERROR,
@@ -564,15 +564,19 @@ RestStatus RestAqlHandler::execute() {
564564
} else if (suffixes[0] == "setup") {
565565
setupClusterQuery();
566566
} else {
567-
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "Unknown POST API";
568-
generateError(rest::ResponseCode::NOT_FOUND, TRI_ERROR_HTTP_NOT_FOUND, "Unknown API");
567+
std::string msg("Unknown POST API: ");
568+
msg += arangodb::basics::StringUtils::join(suffixes, '/');
569+
LOG_TOPIC(ERR, arangodb::Logger::AQL) << msg;
570+
generateError(rest::ResponseCode::NOT_FOUND, TRI_ERROR_HTTP_NOT_FOUND, std::move(msg));
569571
}
570572
break;
571573
}
572574
case rest::RequestType::PUT: {
573575
if (suffixes.size() != 2) {
574-
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "unknown PUT API";
575-
generateError(rest::ResponseCode::NOT_FOUND, TRI_ERROR_HTTP_NOT_FOUND, "unknown PUT API");
576+
std::string msg("Unknown PUT API: ");
577+
msg += arangodb::basics::StringUtils::join(suffixes, '/');
578+
LOG_TOPIC(ERR, arangodb::Logger::AQL) << msg;
579+
generateError(rest::ResponseCode::NOT_FOUND, TRI_ERROR_HTTP_NOT_FOUND, std::move(msg));
576580
} else {
577581
auto status = useQuery(suffixes[0], suffixes[1]);
578582
if (status == RestStatus::WAITING) {
@@ -585,8 +589,10 @@ RestStatus RestAqlHandler::execute() {
585589
// in 3.3, the only GET API was /_api/aql/hasMore. Now, there is none in 3.4.
586590
// we need to keep the old route for compatibility with 3.3 however.
587591
if (suffixes.size() != 2 || suffixes[0] != "hasMore") {
588-
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "Unknown GET API: " << suffixes;
589-
generateError(rest::ResponseCode::NOT_FOUND, TRI_ERROR_HTTP_NOT_FOUND, "Unknown GET API");
592+
std::string msg("Unknown GET API: ");
593+
msg += arangodb::basics::StringUtils::join(suffixes, '/');
594+
LOG_TOPIC(ERR, arangodb::Logger::AQL) << msg;
595+
generateError(rest::ResponseCode::NOT_FOUND, TRI_ERROR_HTTP_NOT_FOUND, std::move(msg));
590596
} else {
591597
// for /_api/aql/hasMore, now always return with a hard-coded response
592598
// that contains "hasMore" : true. This seems good enough to ensure
@@ -855,7 +861,7 @@ std::shared_ptr<VPackBuilder> RestAqlHandler::parseVelocyPackBody() {
855861
VPackSlice tmp = body->slice();
856862
if (!tmp.isObject()) {
857863
// Validate the input has correct format.
858-
LOG_TOPIC(ERR, arangodb::Logger::FIXME)
864+
LOG_TOPIC(ERR, arangodb::Logger::AQL)
859865
<< "body of request must be a VelocyPack object";
860866
generateError(rest::ResponseCode::BAD, TRI_ERROR_HTTP_BAD_PARAMETER,
861867
"body of request must be a VelcoyPack object");

0 commit comments

Comments
 (0)
0