1
0
Fork 0

make sure all error code names are prefixed with ERROR_ @fceller @kvs85 (#9384)

This commit is contained in:
Jan 2019-07-02 18:07:33 +02:00 committed by GitHub
parent 506a735c1b
commit 11f5f33659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 51 deletions

View File

@ -229,10 +229,10 @@ struct ClusterCommResult {
errorMessage = TRI_errno_string(errorCode);
this->errorCode = errorCode;
switch (errorCode) {
case TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT:
case TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT:
status = CL_COMM_BACKEND_UNAVAILABLE;
break;
case TRI_COMMUNICATOR_REQUEST_ABORTED:
case TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED:
status = CL_COMM_BACKEND_UNAVAILABLE;
break;
case TRI_ERROR_HTTP_SERVICE_UNAVAILABLE:

View File

@ -290,7 +290,7 @@ arangodb::Result tryCreateDatabase(std::string const& name) {
} catch (...) {
LOG_TOPIC("832ef", FATAL, arangodb::Logger::RESTORE)
<< "cannot create server connection, giving up!";
return {TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT};
return {TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT};
}
VPackBuilder builder;
@ -1381,7 +1381,7 @@ void RestoreFeature::start() {
result = _clientManager.getConnectedClient(httpClient, _options.force,
true, !_options.createDatabase);
if (result.is(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT)) {
if (result.is(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT)) {
LOG_TOPIC("c23bf", FATAL, Logger::RESTORE)
<< "cannot create server connection, giving up!";
FATAL_ERROR_EXIT();
@ -1466,7 +1466,7 @@ void RestoreFeature::start() {
result = _clientManager.getConnectedClient(httpClient, _options.force,
false, !_options.createDatabase);
if (result.is(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT)) {
if (result.is(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT)) {
LOG_TOPIC("3e715", FATAL, Logger::RESTORE)
<< "cannot create server connection, giving up!";
FATAL_ERROR_EXIT();

View File

@ -368,7 +368,7 @@ static void ClientConnection_ConstructorCallback(v8::FunctionCallbackInfo<v8::Va
std::string errorMessage =
"Could not connect. Error message: " + v8connection->lastErrorMessage();
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT,
errorMessage);
}
@ -1494,7 +1494,7 @@ v8::Local<v8::Value> V8ClientConnection::requestData(
auto connection = std::atomic_load(&_connection);
if (!connection) {
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT,
"not connected");
return v8::Undefined(isolate);
}
@ -1553,7 +1553,7 @@ v8::Local<v8::Value> V8ClientConnection::requestDataRaw(
auto connection = std::atomic_load(&_connection);
if (!connection) {
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT,
"not connected");
return v8::Undefined(isolate);
}
@ -1642,19 +1642,19 @@ v8::Local<v8::Value> V8ClientConnection::handleResult(v8::Isolate* isolate,
switch (ec) {
case fuerte::Error::CouldNotConnect:
case fuerte::Error::ConnectionClosed:
errorNumber = TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT;
errorNumber = TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT;
break;
case fuerte::Error::ReadError:
errorNumber = TRI_SIMPLE_CLIENT_COULD_NOT_READ;
errorNumber = TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_READ;
break;
case fuerte::Error::WriteError:
errorNumber = TRI_SIMPLE_CLIENT_COULD_NOT_WRITE;
errorNumber = TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE;
break;
default:
errorNumber = TRI_SIMPLE_CLIENT_UNKNOWN_ERROR;
errorNumber = TRI_ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR;
break;
}

View File

@ -86,7 +86,7 @@ Result ClientManager::getConnectedClient(std::unique_ptr<httpclient::SimpleHttpC
httpClient = client->createHttpClient();
} catch (...) {
LOG_TOPIC("2b5fd", FATAL, _topic) << "cannot create server connection, giving up!";
return {TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT};
return {TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT};
}
// set client parameters

View File

@ -294,12 +294,12 @@
"ERROR_GRAPH_EDGE_DEFINITION_IS_DOCUMENT" : { "code" : 1944, "message" : "edge definition collection is a document collection" },
"ERROR_SESSION_UNKNOWN" : { "code" : 1950, "message" : "unknown session" },
"ERROR_SESSION_EXPIRED" : { "code" : 1951, "message" : "session expired" },
"SIMPLE_CLIENT_UNKNOWN_ERROR" : { "code" : 2000, "message" : "unknown client error" },
"SIMPLE_CLIENT_COULD_NOT_CONNECT" : { "code" : 2001, "message" : "could not connect to server" },
"SIMPLE_CLIENT_COULD_NOT_WRITE" : { "code" : 2002, "message" : "could not write to server" },
"SIMPLE_CLIENT_COULD_NOT_READ" : { "code" : 2003, "message" : "could not read from server" },
"COMMUNICATOR_REQUEST_ABORTED" : { "code" : 2100, "message" : "Request aborted" },
"COMMUNICATOR_DISABLED" : { "code" : 2101, "message" : "Communication was disabled" },
"ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR" : { "code" : 2000, "message" : "unknown client error" },
"ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT" : { "code" : 2001, "message" : "could not connect to server" },
"ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE" : { "code" : 2002, "message" : "could not write to server" },
"ERROR_SIMPLE_CLIENT_COULD_NOT_READ" : { "code" : 2003, "message" : "could not read from server" },
"ERROR_COMMUNICATOR_REQUEST_ABORTED" : { "code" : 2100, "message" : "Request aborted" },
"ERROR_COMMUNICATOR_DISABLED" : { "code" : 2101, "message" : "Communication was disabled" },
"ERROR_INTERNAL_AQL" : { "code" : 2200, "message" : "General internal AQL error" },
"ERROR_WROTE_TOO_FEW_OUTPUT_REGISTERS" : { "code" : 2201, "message" : "An AQL block wrote too few output registers" },
"ERROR_WROTE_TOO_MANY_OUTPUT_REGISTERS" : { "code" : 2202, "message" : "An AQL block wrote too many output registers" },

View File

@ -394,17 +394,17 @@ ERROR_SESSION_EXPIRED,1951,"session expired","Will be raised when a session is e
## Simple Client errors
################################################################################
SIMPLE_CLIENT_UNKNOWN_ERROR,2000,"unknown client error","This error should not happen."
SIMPLE_CLIENT_COULD_NOT_CONNECT,2001,"could not connect to server","Will be raised when the client could not connect to the server."
SIMPLE_CLIENT_COULD_NOT_WRITE,2002,"could not write to server","Will be raised when the client could not write data."
SIMPLE_CLIENT_COULD_NOT_READ,2003,"could not read from server","Will be raised when the client could not read data."
ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR,2000,"unknown client error","This error should not happen."
ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT,2001,"could not connect to server","Will be raised when the client could not connect to the server."
ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE,2002,"could not write to server","Will be raised when the client could not write data."
ERROR_SIMPLE_CLIENT_COULD_NOT_READ,2003,"could not read from server","Will be raised when the client could not read data."
################################################################################
## Communicator errors
################################################################################
COMMUNICATOR_REQUEST_ABORTED,2100,"Request aborted","Request was aborted."
COMMUNICATOR_DISABLED,2101,"Communication was disabled","Communication was disabled."
ERROR_COMMUNICATOR_REQUEST_ABORTED,2100,"Request aborted","Request was aborted."
ERROR_COMMUNICATOR_DISABLED,2101,"Communication was disabled","Communication was disabled."
################################################################################
## internal AQL errors

View File

@ -293,12 +293,12 @@ void TRI_InitializeErrorMessages() {
REG_ERROR(ERROR_GRAPH_EDGE_DEFINITION_IS_DOCUMENT, "edge definition collection is a document collection");
REG_ERROR(ERROR_SESSION_UNKNOWN, "unknown session");
REG_ERROR(ERROR_SESSION_EXPIRED, "session expired");
REG_ERROR(SIMPLE_CLIENT_UNKNOWN_ERROR, "unknown client error");
REG_ERROR(SIMPLE_CLIENT_COULD_NOT_CONNECT, "could not connect to server");
REG_ERROR(SIMPLE_CLIENT_COULD_NOT_WRITE, "could not write to server");
REG_ERROR(SIMPLE_CLIENT_COULD_NOT_READ, "could not read from server");
REG_ERROR(COMMUNICATOR_REQUEST_ABORTED, "Request aborted");
REG_ERROR(COMMUNICATOR_DISABLED, "Communication was disabled");
REG_ERROR(ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR, "unknown client error");
REG_ERROR(ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT, "could not connect to server");
REG_ERROR(ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE, "could not write to server");
REG_ERROR(ERROR_SIMPLE_CLIENT_COULD_NOT_READ, "could not read from server");
REG_ERROR(ERROR_COMMUNICATOR_REQUEST_ABORTED, "Request aborted");
REG_ERROR(ERROR_COMMUNICATOR_DISABLED, "Communication was disabled");
REG_ERROR(ERROR_INTERNAL_AQL, "General internal AQL error");
REG_ERROR(ERROR_WROTE_TOO_FEW_OUTPUT_REGISTERS, "An AQL block wrote too few output registers");
REG_ERROR(ERROR_WROTE_TOO_MANY_OUTPUT_REGISTERS, "An AQL block wrote too many output registers");

View File

@ -1555,35 +1555,35 @@ constexpr int TRI_ERROR_SESSION_UNKNOWN
/// Will be raised when a session is expired.
constexpr int TRI_ERROR_SESSION_EXPIRED = 1951;
/// 2000: SIMPLE_CLIENT_UNKNOWN_ERROR
/// 2000: ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR
/// "unknown client error"
/// This error should not happen.
constexpr int TRI_SIMPLE_CLIENT_UNKNOWN_ERROR = 2000;
constexpr int TRI_ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR = 2000;
/// 2001: SIMPLE_CLIENT_COULD_NOT_CONNECT
/// 2001: ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT
/// "could not connect to server"
/// Will be raised when the client could not connect to the server.
constexpr int TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT = 2001;
constexpr int TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT = 2001;
/// 2002: SIMPLE_CLIENT_COULD_NOT_WRITE
/// 2002: ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE
/// "could not write to server"
/// Will be raised when the client could not write data.
constexpr int TRI_SIMPLE_CLIENT_COULD_NOT_WRITE = 2002;
constexpr int TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE = 2002;
/// 2003: SIMPLE_CLIENT_COULD_NOT_READ
/// 2003: ERROR_SIMPLE_CLIENT_COULD_NOT_READ
/// "could not read from server"
/// Will be raised when the client could not read data.
constexpr int TRI_SIMPLE_CLIENT_COULD_NOT_READ = 2003;
constexpr int TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_READ = 2003;
/// 2100: COMMUNICATOR_REQUEST_ABORTED
/// 2100: ERROR_COMMUNICATOR_REQUEST_ABORTED
/// "Request aborted"
/// Request was aborted.
constexpr int TRI_COMMUNICATOR_REQUEST_ABORTED = 2100;
constexpr int TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED = 2100;
/// 2101: COMMUNICATOR_DISABLED
/// 2101: ERROR_COMMUNICATOR_DISABLED
/// "Communication was disabled"
/// Communication was disabled.
constexpr int TRI_COMMUNICATOR_DISABLED = 2101;
constexpr int TRI_ERROR_COMMUNICATOR_DISABLED = 2101;
/// 2200: ERROR_INTERNAL_AQL
/// "General internal AQL error"

View File

@ -283,7 +283,7 @@ void Communicator::createRequestInProgress(std::unique_ptr<NewRequest> newReques
<< "Request to '" << newRequest->_destination
<< "' was not even started because communication is disabled";
callErrorFn(ticketId, newRequest->_destination,
newRequest->_callbacks, TRI_COMMUNICATOR_DISABLED, {nullptr});
newRequest->_callbacks, TRI_ERROR_COMMUNICATOR_DISABLED, {nullptr});
return;
}
@ -540,20 +540,20 @@ void Communicator::handleResult(CURL* handle, CURLcode rc) {
case CURLE_COULDNT_RESOLVE_HOST:
case CURLE_URL_MALFORMAT:
case CURLE_SEND_ERROR:
callErrorFn(rip, TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT, {nullptr});
callErrorFn(rip, TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT, {nullptr});
break;
case CURLE_OPERATION_TIMEDOUT:
case CURLE_RECV_ERROR:
case CURLE_GOT_NOTHING:
if (rip->_aborted || (CURLE_OPERATION_TIMEDOUT == rc && 0.0 == connectTime)) {
callErrorFn(rip, TRI_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
callErrorFn(rip, TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
} else {
callErrorFn(rip, TRI_ERROR_CLUSTER_TIMEOUT, {nullptr});
}
break;
case CURLE_WRITE_ERROR:
if (rip->_aborted) {
callErrorFn(rip, TRI_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
callErrorFn(rip, TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
} else {
LOG_TOPIC("1d6e6", ERR, arangodb::Logger::FIXME)
<< "got a write error from curl but request was not aborted";
@ -562,7 +562,7 @@ void Communicator::handleResult(CURL* handle, CURLcode rc) {
break;
case CURLE_ABORTED_BY_CALLBACK:
TRI_ASSERT(rip->_aborted);
callErrorFn(rip, TRI_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
callErrorFn(rip, TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
break;
default:
LOG_TOPIC("a1f90", ERR, arangodb::Logger::FIXME) << "curl return " << rc;

View File

@ -347,10 +347,10 @@ bool GeneralClientConnection::prepare(TRI_socket_t socket, double timeout, bool
if (res == 0) {
if (isWrite) {
_errorDetails = std::string("timeout during write");
TRI_set_errno(TRI_SIMPLE_CLIENT_COULD_NOT_WRITE);
TRI_set_errno(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE);
} else {
_errorDetails = std::string("timeout during read");
TRI_set_errno(TRI_SIMPLE_CLIENT_COULD_NOT_READ);
TRI_set_errno(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_READ);
}
} else { // res < 0
#ifdef _WIN32

View File

@ -47,7 +47,7 @@ TEST(SimpleHttpClientCommunicatorTest, requests_are_properly_aborted) {
callbacksCalled = true;
}, [&callbacksCalled](int errorCode, std::unique_ptr<GeneralResponse> response) {
ASSERT_TRUE(!response);
ASSERT_TRUE(errorCode == TRI_COMMUNICATOR_REQUEST_ABORTED);
ASSERT_TRUE(errorCode == TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED);
callbacksCalled = true;
});
auto request = std::unique_ptr<HttpRequest>(HttpRequest::createHttpRequest(rest::ContentType::TEXT, "", 0, {}));