8000 make sure all error code names are prefixed with ERROR_ @fceller @kvs… · Mars2018/arangodb@11f5f33 · GitHub
[go: up one dir, main page]

Skip to content

Commit 11f5f33

Browse files
authored
make sure all error code names are prefixed with ERROR_ @fceller @KVS85 (arangodb#9384)
1 parent 506a735 commit 11f5f33

File tree

11 files changed

+51
-51
lines changed

11 files changed

+51
-51
lines changed

arangod/Cluster/ClusterComm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ struct ClusterCommResult {
229229
errorMessage = TRI_errno_string(errorCode);
230230
this->errorCode = errorCode;
231231
switch (errorCode) {
232-
case TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT:
232+
case TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT:
233233
status = CL_COMM_BACKEND_UNAVAILABLE;
234234
break;
235-
case TRI_COMMUNICATOR_REQUEST_ABORTED:
235+
case TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED:
236236
status = CL_COMM_BACKEND_UNAVAILABLE;
237237
break;
238238
case TRI_ERROR_HTTP_SERVICE_UNAVAILABLE:

arangosh/Restore/RestoreFeature.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ arangodb::Result tryCreateDatabase(std::string const& name) {
290290
} catch (...) {
291291
LOG_TOPIC("832ef", FATAL, arangodb::Logger::RESTORE)
292292
<< "cannot create server connection, giving up!";
293-
return {TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT};
293+
return {TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT};
294294
}
295295

296296
VPackBuilder builder;
@@ -1381,7 +1381,7 @@ void RestoreFeature::start() {
13811381

13821382
result = _clientManager.getConnectedClient(httpClient, _options.force,
13831383
true, !_options.createDatabase);
1384-
if (result.is(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT)) {
1384+
if (result.is(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT)) {
13851385
LOG_TOPIC("c23bf", FATAL, Logger::RESTORE)
13861386
<< "cannot create server connection, giving up!";
13871387
FATAL_ERROR_EXIT();
@@ -1466,7 +1466,7 @@ void RestoreFeature::start() {
14661466

14671467
result = _clientManager.getConnectedClient(httpClient, _options.force,
14681468
false, !_options.createDatabase);
1469-
if (result.is(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT)) {
1469+
if (result.is(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT)) {
14701470
LOG_TOPIC("3e715", FATAL, Logger::RESTORE)
14711471
<< "cannot create server connection, giving up!";
14721472
FATAL_ERROR_EXIT();

arangosh/Shell/V8ClientConnection.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ static void ClientConnection_ConstructorCallback(v8::FunctionCallbackInfo<v8::Va
368368
std::string errorMessage =
369369
"Could not connect. Error message: " + v8connection->lastErrorMessage();
370370

371-
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
371+
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT,
372372
errorMessage);
373373
}
374374

@@ -1494,7 +1494,7 @@ v8::Local<v8::Value> V8ClientConnection::requestData(
14941494

14951495
auto connection = std::atomic_load(&_connection);
14961496
if (!connection) {
1497-
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
1497+
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT,
14981498
"not connected");
14991499
return v8::Undefined(isolate);
15001500
}
@@ -1553,7 +1553,7 @@ v8::Local<v8::Value> V8ClientConnection::requestDataRaw(
15531553

15541554
auto connection = std::atomic_load(&_connection);
15551555
if (!connection) {
1556-
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
1556+
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT,
15571557
"not connected");
15581558
return v8::Undefined(isolate);
15591559
}
@@ -1642,19 +1642,19 @@ v8::Local<v8::Value> V8ClientConnection::handleResult(v8::Isolate* isolate,
16421642
switch (ec) {
16431643
case fuerte::Error::CouldNotConnect:
16441644
case fuerte::Error::ConnectionClosed:
1645-
errorNumber = TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT;
1645+
errorNumber = TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT;
16461646
break;
16471647

16481648
case fuerte::Error::ReadError:
1649-
errorNumber = TRI_SIMPLE_CLIENT_COULD_NOT_READ;
1649+
errorNumber = TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_READ;
16501650
break;
16511651

16521652
case fuerte::Error::WriteError:
1653-
errorNumber = TRI_SIMPLE_CLIENT_COULD_NOT_WRITE;
1653+
errorNumber = TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE;
16541654
break;
16551655

16561656
default:
1657-
errorNumber = TRI_SIMPLE_CLIENT_UNKNOWN_ERROR;
1657+
errorNumber = TRI_ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR;
16581658
break;
16591659
}
16601660

arangosh/Utils/ClientManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Result ClientManager::getConnectedClient(std::unique_ptr<httpclient::SimpleHttpC
8686
httpClient = client->createHttpClient();
8787
} catch (...) {
8888
LOG_TOPIC("2b5fd", FATAL, _topic) << "cannot create server connection, giving up!";
89-
return {TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT};
89+
return {TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT};
9090
}
9191

9292
// set client parameters

js/common/bootstrap/errors.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,12 @@
294294
"ERROR_GRAPH_EDGE_DEFINITION_IS_DOCUMENT" : { "code" : 1944, "message" : "edge definition collection is a document collection" },
295295
"ERROR_SESSION_UNKNOWN" : { "code" : 1950, "message" : "unknown session" },
296296
"ERROR_SESSION_EXPIRED" : { "code" : 1951, "message" : "session expired" },
297-
"SIMPLE_CLIENT_UNKNOWN_ERROR" : { "code" : 2000, "message" : "unknown client error" },
298-
"SIMPLE_CLIENT_COULD_NOT_CONNECT" : { "code" : 2001, "message" : "could not connect to server" },
299-
"SIMPLE_CLIENT_COULD_NOT_WRITE" : { "code" : 2002, "message" : "could not write to server" },
300-
"SIMPLE_CLIENT_COULD_NOT_READ" : { "code" : 2003, "message" : "could not read from server" },
301-
"COMMUNICATOR_REQUEST_ABORTED" : { "code" : 2100, "message" : "Request aborted" },
302-
"COMMUNICATOR_DISABLED" : { "code" : 2101, "message" : "Communication was disabled" },
297+
"ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR" : { "code" : 2000, "message" : "unknown client error" },
298+
"ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT" : { "code" : 2001, "message" : "could not connect to server" },
299+
"ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE" : { "code" : 2002, "message" : "could not write to server" },
300+
"ERROR_SIMPLE_CLIENT_COULD_NOT_READ" : { "code" : 2003, "message" : "could not read from server" },
301+
"ERROR_COMMUNICATOR_REQUEST_ABORTED" : { "code" : 2100, "message" : "Request aborted" },
302+
"ERROR_COMMUNICATOR_DISABLED" : { "code" : 2101, "message" : "Communication was disabled" },
303303
"ERROR_INTERNAL_AQL" : { "code" : 2200, "message" : "General internal AQL error" },
304304
"ERROR_WROTE_TOO_FEW_OUTPUT_REGISTERS" : { "code" : 2201, "message" : "An AQL block wrote too few output registers" },
305305
"ERROR_WROTE_TOO_MANY_OUTPUT_REGISTERS" : { "code" : 2202, "message" : "An AQL block wrote too many output registers" },

lib/Basics/errors.dat

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,17 +394,17 @@ ERROR_SESSION_EXPIRED,1951,"session expired","Will be raised when a session is e
394394
## Simple Client errors
395395
################################################################################
396396

397-
SIMPLE_CLIENT_UNKNOWN_ERROR,2000,"unknown client error","This error should not happen."
398-
SIMPLE_CLIENT_COULD_NOT_CONNECT,2001,"could not connect to server","Will be raised when the client could not connect to the server."
399-
SIMPLE_CLIENT_COULD_NOT_WRITE,2002,"could not write to server","Will be raised when the client could not write data."
400-
SIMPLE_CLIENT_COULD_NOT_READ,2003,"could not read from server","Will be raised when the client could not read data."
397+
ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR,2000,"unknown client error","This error should not happen."
398+
ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT,2001,"could not connect to server","Will be raised when the client could not connect to the server."
399+
ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE,2002,"could not write to server","Will be raised when the client could not write data."
400+
ERROR_SIMPLE_CLIENT_COULD_NOT_READ,2003,"could not read from server","Will be raised when the client could not read data."
401401

402402
################################################################################
403403
## Communicator errors
404404
################################################################################
405405

406-
COMMUNICATOR_REQUEST_ABORTED,2100,"Request aborted","Request was aborted."
407-
COMMUNICATOR_DISABLED,2101,"Communication was disabled","Communication was disabled."
406+
ERROR_COMMUNICATOR_REQUEST_ABORTED,2100,"Request aborted","Request was aborted."
407+
ERROR_COMMUNICATOR_DISABLED,2101,"Communication was disabled","Communication was disabled."
408408

409409
################################################################################
410410
## internal AQL errors

lib/Basics/voc-errors.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,12 @@ void TRI_InitializeErrorMessages() {
293293
REG_ERROR(ERROR_GRAPH_EDGE_DEFINITION_IS_DOCUMENT, "edge definition collection is a document collection");
294294
REG_ERROR(ERROR_SESSION_UNKNOWN, "unknown session");
295295
REG_ERROR(ERROR_SESSION_EXPIRED, "session expired");
296-
REG_ERROR(SIMPLE_CLIENT_UNKNOWN_ERROR, "unknown client error");
297-
REG_ERROR(SIMPLE_CLIENT_COULD_NOT_CONNECT, "could not connect to server");
298-
REG_ERROR(SIMPLE_CLIENT_COULD_NOT_WRITE, "could not write to server");
299-
REG_ERROR(SIMPLE_CLIENT_COULD_NOT_READ, "could not read from server");
300-
REG_ERROR(COMMUNICATOR_REQUEST_ABORTED, "Request aborted");
301-
REG_ERROR(COMMUNICATOR_DISABLED, "Communication was disabled");
296+
REG_ERROR(ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR, "unknown client error");
297+
REG_ERROR(ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT, "could not connect to server");
298+
REG_ERROR(ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE, "could not write to server");
299+
REG_ERROR(ERROR_SIMPLE_CLIENT_COULD_NOT_READ, "could not read from server");
300+
REG_ERROR(ERROR_COMMUNICATOR_REQUEST_ABORTED, "Request aborted");
301+
REG_ERROR(ERROR_COMMUNICATOR_DISABLED, "Communication was disabled");
302302
REG_ERROR(ERROR_INTERNAL_AQL, "General internal AQL error");
303303
REG_ERROR(ERROR_WROTE_TOO_FEW_OUTPUT_REGISTERS, "An AQL block wrote too few output registers");
304304
REG_ERROR(ERROR_WROTE_TOO_MANY_OUTPUT_REGISTERS, "An AQL block wrote too many output registers");

lib/Basics/voc-errors.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,35 +1555,35 @@ constexpr int TRI_ERROR_SESSION_UNKNOWN
15551555
/// Will be raised when a session is expired.
15561556
constexpr int TRI_ERROR_SESSION_EXPIRED = 1951;
15571557

1558-
/// 2000: SIMPLE_CLIENT_UNKNOWN_ERROR
1558+
/// 2000: ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR
15591559
/// "unknown client error"
15601560
/// This error should not happen.
1561-
constexpr int TRI_SIMPLE_CLIENT_UNKNOWN_ERROR = 2000;
1561+
constexpr int TRI_ERROR_SIMPLE_CLIENT_UNKNOWN_ERROR = 2000;
15621562

1563-
/// 2001: SIMPLE_CLIENT_COULD_NOT_CONNECT
1563+
/// 2001: ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT
15641564
/// "could not connect to server"
15651565
/// Will be raised when the client could not connect to the server.
1566-
constexpr int TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT = 2001;
1566+
constexpr int TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT = 2001;
15671567

1568-
/// 2002: SIMPLE_CLIENT_COULD_NOT_WRITE
1568+
/// 2002: ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE
15691569
/// "could not write to server"
15701570
/// Will be raised when the client could not write data.
1571-
constexpr int TRI_SIMPLE_CLIENT_COULD_NOT_WRITE = 2002;
1571+
constexpr int TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE = 2002;
15721572

1573-
/// 2003: SIMPLE_CLIENT_COULD_NOT_READ
1573+
/// 2003: ERROR_SIMPLE_CLIENT_COULD_NOT_READ
15741574
/// "could not read from server"
15751575
/// Will be raised when the client could not read data.
1576-
constexpr int TRI_SIMPLE_CLIENT_COULD_NOT_READ = 2003;
1576+
constexpr int TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_READ = 2003;
15771577

1578-
/// 2100: COMMUNICATOR_REQUEST_ABORTED
1578+
/// 2100: ERROR_COMMUNICATOR_REQUEST_ABORTED
15791579
/// "Request aborted"
15801580
/// Request was aborted.
1581-
constexpr int TRI_COMMUNICATOR_REQUEST_ABORTED = 2100;
1581+
constexpr int TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED = 2100;
15821582

1583-
/// 2101: COMMUNICATOR_DISABLED
1583+
/// 2101: ERROR_COMMUNICATOR_DISABLED
15841584
/// "Communication was disabled"
15851585
/// Communication was disabled.
1586-
constexpr int TRI_COMMUNICATOR_DISABLED = 2101;
1586+
constexpr int TRI_ERROR_COMMUNICATOR_DISABLED = 2101;
15871587

15881588
/// 2200: ERROR_INTERNAL_AQL
15891589
/// "General internal AQL error"

lib/SimpleHttpClient/Communicator.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void Communicator::createRequestInProgress(std::unique_ptr<NewRequest> newReques
283283
<< "Request to '" << newRequest->_destination
284284
<< "' was not even started because communication is disabled";
285285
callErrorFn(ticketId, newRequest->_destination,
286-
newRequest->_callbacks, TRI_COMMUNICATOR_DISABLED, {nullptr});
286+
newRequest->_callbacks, TRI_ERROR_COMMUNICATOR_DISABLED, {nullptr});
287287
return;
288288
}
289289

@@ -540,20 +540,20 @@ void Communicator::handleResult(CURL* handle, CURLcode rc) {
540540
case CURLE_COULDNT_RESOLVE_HOST:
541541
case CURLE_URL_MALFORMAT:
542542
case CURLE_SEND_ERROR:
543-
callErrorFn(rip, TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT, {nullptr});
543+
callErrorFn(rip, TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT, {nullptr});
544544
break;
545545
case CURLE_OPERATION_TIMEDOUT:
546546
case CURLE_RECV_ERROR:
547547
case CURLE_GOT_NOTHING:
548548
if (rip->_aborted || (CURLE_OPERATION_TIMEDOUT == rc && 0.0 == connectTime)) {
549-
callErrorFn(rip, TRI_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
549+
callErrorFn(rip, TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
550550
} else {
551551
callErrorFn(rip, TRI_ERROR_CLUSTER_TIMEOUT, {nullptr});
552552
}
553553
break;
554554
case CURLE_WRITE_ERROR:
555555
if (rip->_aborted) {
556-
callErrorFn(rip, TRI_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
556+
callErrorFn(rip, TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
557557
} else {
558558
LOG_TOPIC("1d6e6", ERR, arangodb::Logger::FIXME)
559559
<< "got a write error from curl but request was not aborted";
@@ -562,7 +562,7 @@ void Communicator::handleResult(CURL* handle, CURLcode rc) {
562562
break;
563563
case CURLE_ABORTED_BY_CALLBACK:
564564
TRI_ASSERT(rip->_aborted);
565-
callErrorFn(rip, TRI_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
565+
callErrorFn(rip, TRI_ERROR_COMMUNICATOR_REQUEST_ABORTED, {nullptr});
566566
break;
567567
default:
568568
LOG_TOPIC("a1f90", ERR, arangodb::Logger::FIXME) << "curl return " << rc;

lib/SimpleHttpClient/GeneralClientConnection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,10 @@ bool GeneralClientConnection::prepare(TRI_socket_t socket, double timeout, bool
347347
if (res == 0) {
348348
if (isWrite) {
349349
_errorDetails = std::string("timeout during write");
350-
TRI_set_errno(TRI_SIMPLE_CLIENT_COULD_NOT_WRITE);
350+
TRI_set_errno(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_WRITE);
351351
} else {
352352
_errorDetails = std::string("timeout during read");
353-
TRI_set_errno(TRI_SIMPLE_CLIENT_COULD_NOT_READ);
353+
TRI_set_errno(TRI_ERROR_SIMPLE_CLIENT_COULD_NOT_READ);
354354
}
355355
} else { // res < 0
356356
#ifdef _WIN32

0 commit comments

Comments
 (0)
0