8000 Use frozen::unordered_map for ErrorMessages by goedderz · Pull Request #13496 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content
8000

Use frozen::unordered_map for ErrorMessages #13496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 90 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
3e30055
Made Result contain only an optional pointer to an error
goedderz Jan 21, 2021
fd78e02
Fixed compile error
goedderz Jan 21, 2021
df2e43c
Avoid no-error allocations
goedderz Jan 21, 2021
d447876
WIP
goedderz Jan 25, 2021
4d8d9b1
WIP
goedderz Jan 25, 2021
ab77f45
Added concatT and joinT to StringUtils
goedderz Jan 25, 2021
331fad5
Fixed tests
goedderz Jan 25, 2021
bfc7901
Merge branch 'feature/string-utils-concat-join' of github.com:arangod…
goedderz Jan 25, 2021
699a5dc
Changed namespace from impl to detail
goedderz Jan 25, 2021
8aa96ae
Assert capacity
goedderz Jan 25, 2021
b0e1b0c
Fixed compile errors
goedderz Jan 25, 2021
83bb4f8
Return a string_view in Result::errorMessage
goedderz Jan 25, 2021
c2435bc
Removed erroneous line
goedderz Jan 25, 2021
6949f89
Merge branch 'feature/refactor-error-message-string-view' of github.c…
goedderz Jan 25, 2021
0fed08d
Fixed some compile errors
goedderz Jan 26, 2021
d91cfb5
Some minor changes
goedderz Jan 26, 2021
6eb6ee1
Merge branch 'feature/refactor-error-message-string-view' of github.c…
goedderz Jan 26, 2021
1956b21
Update lib/Basics/ResultT.h
goedderz Jan 26, 2021
f5de874
Merge branch 'feature/refactor-error-message-string-view' of github.c…
goedderz Jan 26, 2021
84511fb
Fixed Mac compile error
goedderz Jan 26, 2021
eaacdc0
Merge branch 'feature/string-utils-concat-join' of github.com:arangod…
goedderz Jan 26, 2021
d988cf8
Merge branch 'feature/refactor-error-message-string-view' of github.c…
goedderz Jan 26, 2021
6d83aeb
Update lib/Basics/Result.h
goedderz Jan 27, 2021
937877d
Added errorMessage move overloads
goedderz Jan 27, 2021
4d49f20
Added noexcept where mentioned in reviews
goedderz Jan 27, 2021
0e098b2
Be consistent.
goedderz Jan 27, 2021
9c209b3
Merge branch 'devel' of github.com:arangodb/arangodb into feature/sma…
goedderz Jan 27, 2021
9e25112
Removed superfluous lines
goedderz Jan 27, 2021
bc3c0ef
Merge branch 'devel' of github.com:arangodb/arangodb into feature/sma…
goedderz Jan 27, 2021
27fb946
Fixed merge conflict
goedderz Jan 27, 2021
0433a27
Minor changes
goedderz Jan 27, 2021
0fa6aa1
Added some assertions
goedderz Jan 28, 2021
76f2312
Pass conflictingDocumentKey separately, no longer in a Result's error…
goedderz Jan 28, 2021
690c2d7
Fixed prior commit
goedderz Jan 28, 2021
01ed70a
Added ErrorCode and changed errorfile generation accordingly
goedderz Jan 28, 2021
e57dd14
Regenerate errorfiles if the script changed as well
goedderz Jan 28, 2021
932818c
Make libarango compile with ErrorCode
goedderz Jan 28, 2021
5566c81
Make arango_v8 compile
goedderz Jan 29, 2021
fa8baa3
Make arango_network compile
goedderz Jan 29, 2021
7c49d47
Make arango_shell compile
goedderz Jan 29, 2021
d381218
Make arango_indexes and arango_cluster_engine compile
goedderz Jan 29, 2021
ff8c330
Made arangosh compile
goedderz Jan 29, 2021
4c95166
Made arango_cluster_methods compile
goedderz Jan 29, 2021
a52fe06
Made arangobench compile
goedderz Jan 29, 2021
b555dc1
Made arangoimport, -backup, -restore, and -dump compile
goedderz Jan 29, 2021
b927c56
Made arango_iresearch compile
goedderz Jan 29, 2021
dfe105a
Made arango_storage_engine_common compile
goedderz Jan 29, 2021
f816181
Fix compile error
goedderz Jan 29, 2021
2fa9254
Made arango_agency compile
goedderz Jan 29, 2021
0fc65b7
Made arango_pregel compile
goedderz Jan 29, 2021
a6e7b67
Fixed assertion
goedderz Jan 29, 2021
61e06c6
Made arango_common_rest_handler compile
goedderz Jan 29, 2021
411fec1
Made arango_rocksdb compile
goedderz Jan 29, 2021
d2e717f
Made arango_storage_engine compile
goedderz Jan 29, 2021
1a8d2d6
Made arango_replication compile
goedderz Jan 29, 2021
c812ab7
Merge branch 'feature/small-result-with-external-error' of github.com…
goedderz Jan 29, 2021
943bf3e
Fix
goedderz Feb 1, 2021
e928f04
Only return conflicting key when it's meaningful, to soothe an assertion
goedderz Feb 1, 2021
23b957d
Made arango_vocbase compile
goedderz Feb 1, 2021
0d78b83
Reformat
goedderz Feb 1, 2021
ef30942
Added a comment
goedderz Feb 1, 2021
a29e7bd
Addressed review comments
goedderz Feb 1, 2021
ea52266
Made arango_graph compile
goedderz Feb 1, 2021
a4980a4
Made arango_aql compile
goedderz Feb 1, 2021
672b488
Made arango_v8server compile
goedderz Feb 3, 2021
359575c
Made arangosh compile
goedderz Feb 3, 2021
aeb1ce9
Made arangoserver compile
goedderz Feb 3, 2021
799d190
Merge commit '0737c305c536043a3cde5916957dd2714836d25f' into tmp
goedderz Feb 3, 2021
2580766
Merge branch 'tmp' into feature/strict-typing-for-error-codes
goedderz Feb 3, 2021
64ffbc6
Merge branch 'devel' of github.com:arangodb/arangodb into feature/str…
goedderz Feb 3, 2021
a90d8fb
Made arangodbtests compile
goedderz Feb 3, 2021
92cec6f
Fixed compile errors in CE and tests
goedderz Feb 3, 2021
bd5265e
reformat
goedderz Feb 4, 2021
33b212e
Update arangod/GeneralServer/RestHandler.cpp
goedderz Feb 5, 2021
9523d4b
Update lib/Basics/tri-zip.cpp
goedderz Feb 5, 2021
eb92d47
Update lib/V8/v8-utils.cpp
goedderz Feb 5, 2021
e428231
Addressed review comments
goedderz Feb 5, 2021
ba6f370
Merge branch 'feature/strict-typing-for-error-codes' of github.com:ar…
goedderz Feb 5, 2021
551dd4e
Use frozen::unordered_map for ErrorMessages
goedderz Feb 5, 2021
15d03dc
Update lib/Basics/files.cpp
goedderz Feb 5, 2021
8fc6866
Merge branch 'devel' of github.com:arangodb/arangodb into feature/str…
goedderz Feb 5, 2021
7cefbf0
Merge branch 'feature/strict-typing-for-error-codes' of github.com:ar…
goedderz Feb 5, 2021
1815cf1
Fixed merge conflict: regenerated errorfiles
goedderz Feb 8, 2021
3ca1a7b
Merge branch 'devel' of github.com:arangodb/arangodb into feature/str…
goedderz Feb 8, 2021
11f9cc4
Fix alignment to the previous column
goedderz Feb 8, 2021
2c09f65
Regenerated errorfiles
goedderz Feb 8, 2021
4d12b63
Merge commit '0e41342ee8c823cb8952462134a6928e22c760ba' into tmp
goedderz Feb 10, 2021
c390c1f
Merge branch 'tmp' into feature/use-frozen-map-for-error-messages
goedderz Feb 10, 2021
220c07f
Merge remote-tracking branch 'origin/devel' into feature/use-frozen-m…
goedderz Feb 10, 2021
d459aaa
Merge branch 'devel' of github.com:arangodb/arangodb into feature/use…
goedderz Feb 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Made arango_cluster_methods compile
  • Loading branch information
goedderz committed Jan 29, 2021
commit 4c951663b9f2b99ccc62863b56b95315e5405562
31 changes: 16 additions & 15 deletions arangod/Cluster/ClusterMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ OperationResult handleCRUDShardResponsesFast(F&& func, CT const& opCtx,
arr.get(StaticStrings::Error).isBoolean() &&
arr.get(StaticStrings::Error).getBoolean()) {
// an error occurred, now rethrow the error
int res = arr.get(StaticStrings::ErrorNum).getNumericValue<int>();
auto res = ::ErrorCode{arr.get(StaticStrings::ErrorNum).getNumericValue<int>()};
VPackSlice msg = arr.get(StaticStrings::ErrorMessage);
if (msg.isString()) {
THROW_ARANGO_EXCEPTION_MESSAGE(res, msg.copyString());
Expand All @@ -385,7 +385,7 @@ OperationResult handleCRUDShardResponsesSlow(F&& func, size_t expectedLen, Opera
std::shared_ptr<VPackBuffer<uint8_t>> buffer;

int nrok = 0;
int commError = TRI_ERROR_NO_ERROR;
auto commError = TRI_ERROR_NO_ERROR;
fuerte::StatusCode code;
for (size_t i = 0; i < responses.size(); i++) {
network::Response const& res = responses[i].get();
Expand Down Expand Up @@ -450,9 +450,8 @@ struct CrudOperationCtx {
/// it returns sth. else this document is NOT contained in the shardMap
////////////////////////////////////////////////////////////////////////////////

int distributeBabyOnShards(CrudOperationCtx& opCtx,
LogicalCollection& collinfo,
VPackSlice const value) {
::ErrorCode distributeBabyOnShards(CrudOperationCtx& opCtx, LogicalCollection& collinfo,
VPackSlice const value) {
TRI_ASSERT(!collinfo.isSmart() || collinfo.type() == TRI_COL_TYPE_DOCUMENT);

ShardID shardID;
Expand All @@ -465,7 +464,7 @@ int distributeBabyOnShards(CrudOperationCtx& opCtx,
} else {
// Now find the responsible shard:
bool usesDefaultShardingAttributes;
int res = collinfo.getResponsibleShard(value, /*docComplete*/false, shardID,
auto res = collinfo.getResponsibleShard(value, /*docComplete*/false, shardID,
usesDefaultShardingAttributes);

8000 if (res == TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND) {
Expand Down Expand Up @@ -2832,8 +2831,8 @@ arangodb::Result hotBackupList(network::ConnectionPool* pool,
}

if (resSlice.get(StaticStrings::Error).getBoolean()) {
return arangodb::Result(static_cast<int>(resSlice.get(StaticStrings::ErrorNum).getNumber<uint64_t>()),
resSlice.get(StaticStrings::ErrorMessage).copyString());
auto res = ::ErrorCode{resSlice.get(StaticStrings::ErrorNum).getNumber<int>()};
return arangodb::Result(res, resSlice.get(StaticStrings::ErrorMessage).copyString());
}

if (!resSlice.hasKey("result") || !resSlice.get("result").isObject()) {
Expand Down Expand Up @@ -3391,7 +3390,7 @@ arangodb::Result lockDBServerTransactions(network::ConnectionPool* pool,

// Now listen to the results and report the aggregated final result:
arangodb::Result finalRes(TRI_ERROR_NO_ERROR);
auto reportError = [&](int c, std::string const& m) {
auto reportError = [&](::ErrorCode c, std::string const& m) {
if (finalRes.ok()) {
finalRes = arangodb::Result(c, m);
} else {
Expand Down Expand Up @@ -3427,8 +3426,9 @@ arangodb::Result lockDBServerTransactions(network::ConnectionPool* pool,
LOG_TOPIC("f4b8f", DEBUG, Logger::BACKUP)
<< "failed to acquire lock from " << r.destination << ": " << slc.toJson();
auto errorNum = slc.get(StaticStrings::ErrorNum).getNumber<int>();
if (errorNum == TRI_ERROR_LOCK_TIMEOUT) {
reportError(errorNum, slc.get(StaticStrings::ErrorMessage).copyString());
auto err = ::ErrorCode{errorNum};
if (err == TRI_ERROR_LOCK_TIMEOUT) {
reportError(err, slc.get(StaticStrings::ErrorMessage).copyString());
continue;
}
reportError(TRI_ERROR_LOCAL_LOCK_FAILED,
Expand Down Expand Up @@ -3676,9 +3676,10 @@ arangodb::Result removeLocalBackups(network::ConnectionPool* pool,

if (!resSlice.hasKey(StaticStrings::Error) || !resSlice.get(StaticStrings::Error).isBoolean() ||
resSlice.get(StaticStrings::Error).getBoolean()) {
int64_t errorNum = resSlice.get(StaticStrings::ErrorNum).getNumber<int64_t>();
auto errorNum = resSlice.get(StaticStrings::ErrorNum).getNumber<int>();
auto res = ::ErrorCode{errorNum};

if (errorNum == TRI_ERROR_FILE_NOT_FOUND) {
if (res == TRI_ERROR_FILE_NOT_FOUND) {
notFoundCount += 1;
continue;
}
Expand All @@ -3689,7 +3690,7 @@ arangodb::Result removeLocalBackups(network::ConnectionPool* pool,
std::to_string(errorNum) + ")";

LOG_TOPIC("9b94f", ERR, Logger::BACKUP) << errorMsg;
return arangodb::Result(static_cast<int>(errorNum), errorMsg);
return arangodb::Result(res, errorMsg);
}
}

Expand Down Expand Up @@ -3824,7 +3825,7 @@ arangodb::Result hotbackupWaitForLockDBServersTransactions(
if (slc.get(StaticStrings::Error).getBoolean()) {
LOG_TOPIC("d7a8a", DEBUG, Logger::BACKUP)
<< "failed to acquire lock from " << r.destination << ": " << slc.toJson();
auto errorNum = slc.get(StaticStrings::ErrorNum).getNumber<int>();
auto errorNum = ::ErrorCode{slc.get(StaticStrings::ErrorNum).getNumber<int>()};
if (errorNum == TRI_ERROR_LOCK_TIMEOUT) {
return arangodb::Result(errorNum, slc.get(StaticStrings::ErrorMessage).copyString());
}
Expand Down
6 changes: 3 additions & 3 deletions arangod/Cluster/ClusterTtlMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Result getTtlStatisticsFromAllDBServers(ClusterFeature& feature, TtlStatistics&
if (r.statusCode() == fuerte::StatusOK) {
out += r.slice().get("result");
} else {
int code = network::errorCodeFromBody(r.slice());
auto code = network::errorCodeFromBody(r.slice());
if (code != TRI_ERROR_NO_ERROR) {
return code;
}
Expand Down Expand Up @@ -108,7 +108,7 @@ Result getTtlPropertiesFromAllDBServers(ClusterFeature& feature, VPackBuilder& o
out.add(r.slice().get("result"));
break;
} else {
int code = network::errorCodeFromBody(r.slice());
auto code = network::errorCodeFromBody(r.slice());
if (code != TRI_ERROR_NO_ERROR) {
return code;
}
Expand Down Expand Up @@ -148,7 +148,7 @@ Result setTtlPropertiesOnAllDBServers(ClusterFeature& feature,
out.add(r.slice().get("result"));
break;
} else {
int code = network::errorCodeFromBody(r.slice());
auto code = network::errorCodeFromBody(r.slice());
if (code != TRI_ERROR_NO_ERROR) {
return code;
}
Expand Down
7 changes: 4 additions & 3 deletions arangod/Sharding/ShardingInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,10 @@ void ShardingInfo::setShardMap(std::shared_ptr<ShardMap> const& map) {
_shardIds = map;
}

int ShardingInfo::getResponsibleShard(arangodb::velocypack::Slice slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
VPackStringRef const& key) {
ErrorCode ShardingInfo::getResponsibleShard(arangodb::velocypack::Slice slice,
bool docComplete, ShardID& shardID,
bool& usesDefaultShardKeys,
VPackStringRef const& key) {
return _shardingStrategy->getResponsibleShard(slice, docComplete, shardID,
usesDefaultShardKeys, key);
}
Expand Down
6 changes: 3 additions & 3 deletions arangod/Sharding/ShardingInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ class ShardingInfo {
std::shared_ptr<ShardMap> shardIds(std::unordered_set<std::string> const& includedShards) const;
void setShardMap(std::shared_ptr<ShardMap> const& map);

int getResponsibleShard(arangodb::velocypack::Slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const&);
ErrorCode getResponsibleShard(arangodb::velocypack::Slice slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key);

static void sortShardNamesNumerically(std::vector<ShardID>& list);

Expand Down
6 changes: 3 additions & 3 deletions arangod/Sharding/ShardingStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ class ShardingStrategy {
/// `_key` is the one and only sharding attribute.
////////////////////////////////////////////////////////////////////////////////

virtual int getResponsibleShard(arangodb::velocypack::Slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key) = 0;
virtual ErrorCode getResponsibleShard(arangodb::velocypack::Slice slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key) = 0;
};

} // namespace arangodb
Expand Down
21 changes: 9 additions & 12 deletions arangod/Sharding/ShardingStrategyDefault.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,9 @@ ShardingStrategyNone::ShardingStrategyNone() : ShardingStrategy() {
}

/// calling getResponsibleShard on this class will always throw an exception
int ShardingStrategyNone::getResponsibleShard(arangodb::velocypack::Slice slice,
bool docComplete, ShardID& shardID,
bool& usesDefaultShardKeys,
VPackStringRef const& key) {
ErrorCode ShardingStrategyNone::getResponsibleShard(
arangodb::velocypack::Slice slice, bool docComplete, ShardID& shardID,
bool& usesDefaultShardKeys, arangodb::velocypack::StringRef const& key) {
THROW_ARANGO_EXCEPTION_MESSAGE(
TRI_ERROR_INTERNAL, "unexpected invocation of ShardingStrategyNone");
}
Expand All @@ -236,10 +235,9 @@ ShardingStrategyOnlyInEnterprise::ShardingStrategyOnlyInEnterprise(std::string c

/// @brief will always throw an exception telling the user the selected sharding
/// is only available in the Enterprise Edition
int ShardingStrategyOnlyInEnterprise::getResponsibleShard(arangodb::velocypack::Slice slice,
bool docComplete, ShardID& shardID,
bool& usesDefaultShardKeys,
VPackStringRef const& key) {
ErrorCode ShardingStrategyOnlyInEnterprise::getResponsibleShard(
arangodb::velocypack::Slice slice, bool docComplete, ShardID& shardID,
bool& usesDefaultShardKeys, arangodb::velocypack::StringRef const& key) {
THROW_ARANGO_EXCEPTION_MESSAGE(
TRI_ERROR_ONLY_ENTERPRISE,
std::string("sharding strategy '") + _name +
Expand Down Expand Up @@ -268,10 +266,9 @@ ShardingStrategyHashBase::ShardingStrategyHashBase(ShardingInfo* sharding)
}
}

int ShardingStrategyHashBase::getResponsibleShard(arangodb::velocypack::Slice slice,
bool docComplete, ShardID& shardID,
bool& usesDefaultShardKeys,
VPackStringRef const& key) {
ErrorCode ShardingStrategyHashBase::getResponsibleShard(
arangodb::velocypack::Slice slice, bool docComplete, ShardID& shardID,
bool& usesDefaultShardKeys, arangodb::velocypack::StringRef const& key) {
static constexpr char const* magicPhrase =
"Foxx you have stolen the goose, give she back again!";
static constexpr size_t magicLength = 52;
Expand Down
18 changes: 9 additions & 9 deletions arangod/Sharding/ShardingStrategyDefault.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class ShardingStrategyNone final : public ShardingStrategy {
/// @brief does not really matter here
bool usesDefaultShardKeys() override { return true; }

int getResponsibleShard(arangodb::velocypack::Slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key) override;
ErrorCode getResponsibleShard(arangodb::velocypack::Slice slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key) override;
};

/// @brief a sharding class used to indicate that the selected sharding strategy
Expand All @@ -66,9 +66,9 @@ class ShardingStrategyOnlyInEnterprise final : public ShardingStrategy {

/// @brief will always throw an exception telling the user the selected
/// sharding is only available in the Enterprise Edition
int getResponsibleShard(arangodb::velocypack::Slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key) override;
ErrorCode getResponsibleShard(arangodb::velocypack::Slice slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key) override;

private:
/// @brief name of the sharding strategy we are replacing
Expand All @@ -80,9 +80,9 @@ class ShardingStrategyHashBase : public ShardingStrategy {
public:
explicit ShardingStrategyHashBase(ShardingInfo* sharding);

virtual int getResponsibleShard(arangodb::velocypack::Slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key) override;
virtual ErrorCode getResponsibleShard(arangodb::velocypack::Slice slice, bool docComplete,
ShardID& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key) override;

/// @brief does not really matter here
bool usesDefaultShardKeys() override { return _usesDefaultShardKeys; }
Expand Down
2 changes: 1 addition & 1 deletion arangod/Transaction/Methods.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class Methods {
bool isInaccessibleCollection(std::string const& /*cname*/) const;
#endif

static int validateSmartJoinAttribute(LogicalCollection const& collinfo,
static ErrorCode validateSmartJoinAttribute(LogicalCollection const& collinfo,
arangodb::velocypack::Slice value);

private:
Expand Down
10 changes: 5 additions & 5 deletions arangod/VocBase/KeyGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class TraditionalKeyGenerator : public KeyGenerator {
}

/// @brief validate a key
int validate(char const* p, size_t length, bool isRestore) override {
ErrorCode validate(char const* p, size_t length, bool isRestore) override {
int res = KeyGenerator::validate(p, length, isRestore);

if (res == TRI_ERROR_NO_ERROR) {
Expand Down Expand Up @@ -397,7 +397,7 @@ class PaddedKeyGenerator : public KeyGenerator {
}

/// @brief validate a key
int validate(char const* p, size_t length, bool isRestore) override {
ErrorCode validate(char const* p, size_t length, bool isRestore) override {
int res = KeyGenerator::validate(p, length, isRestore);

if (res == TRI_ERROR_NO_ERROR) {
Expand Down Expand Up @@ -513,7 +513,7 @@ class AutoIncrementKeyGenerator final : public KeyGenerator {
}

/// @brief validate a key
int validate(char const* p, size_t length, bool isRestore) override {
ErrorCode validate(char const* p, size_t length, bool isRestore) override {
int res = KeyGenerator::validate(p, length, isRestore);

if (res == TRI_ERROR_NO_ERROR) {
Expand Down Expand Up @@ -795,12 +795,12 @@ KeyGenerator* KeyGenerator::factory(application_features::ApplicationServer& ser
}

/// @brief validate a key
int KeyGenerator::validate(char const* p, size_t length, bool isRestore) {
ErrorCode KeyGenerator::validate(char const* p, size_t length, bool isRestore) {
return globalCheck(p, length, isRestore);
}

/// @brief check global key attributes
int KeyGenerator::globalCheck(char const* p, size_t length, bool isRestore) {
ErrorCode KeyGenerator::globalCheck(char const* p, size_t length, bool isRestore) {
// user has specified a key
if (length > 0 && !_allowUserKeys && !isRestore && !_isDBServer) {
// we do not allow user-generated keys
Expand Down
4 changes: 2 additions & 2 deletions arangod/VocBase/KeyGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class KeyGenerator {
virtual std::string generate() = 0;

/// @brief validate a key
virtual int validate(char const* p, size_t length, bool isRestore);
virtual ErrorCode validate(char const* p, size_t length, bool isRestore);

/// @brief track usage of a key
virtual void track(char const* p, size_t length) = 0;
Expand All @@ -98,7 +98,7 @@ class KeyGenerator {

protected:
/// @brief check global key attributes
int globalCheck(char const* p, size_t length, bool isRestore);
ErrorCode globalCheck(char const* p, size_t length, bool isRestore);

protected:
/// @brief whether or not the users can specify their own keys
Expand Down
2 changes: 1 addition & 1 deletion arangod/VocBase/LogicalCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ int LogicalCollection::getResponsibleShard(std::string_view key, std::string& sh
VPackStringRef(key.data(), key.size()));
}

int LogicalCollection::getResponsibleShard(arangodb::velocypack::Slice slice,
ErrorCode LogicalCollection::getResponsibleShard(arangodb::velocypack::Slice slice,
bool docComplete, std::string& shardID,
bool& usesDefaultShardKeys,
VPackStringRef const& key) {
Expand Down
8 changes: 4 additions & 4 deletions arangod/VocBase/LogicalCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ class LogicalCollection : public LogicalDataSource {
int getResponsibleShard(arangodb::velocypack::Slice, bool docComplete, std::string& shardID);
int getResponsibleShard(std::string_view key, std::string& shardID);

int getResponsibleShard(arangodb::velocypack::Slice, bool docComplete,
std::string& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key =
arangodb::velocypack::StringRef());
ErrorCode getResponsibleShard(arangodb::velocypack::Slice slice, bool docComplete,
std::string& shardID, bool& usesDefaultShardKeys,
arangodb::velocypack::StringRef const& key =
arangodb::velocypack::StringRef());

/// @briefs creates a new document key, the input slice is ignored here
/// this method is overriden in derived classes
Expand Down
10000
1 change: 1 addition & 0 deletions js/common/bootstrap/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"ERROR_CANNOT_READ_FILE" : { "code" : 34, "message" : "cannot read file" },
"ERROR_INCOMPATIBLE_VERSION" : { "code" : 35, "message" : "incompatible server version" },
"ERROR_DISABLED" : { "code" : 36, "message" : "disabled" },
"ERROR_MALFORMED_JSON" : { "code" : 37, "message" : "malformed json" },
"ERROR_HTTP_BAD_PARAMETER" : { "code" : 400, "message" : "bad parameter" },
"ERROR_HTTP_UNAUTHORIZED" : { "code" : 401, "message" : "unauthorized" },
"ERROR_HTTP_FORBIDDEN" : { "code" : 403, "message" : "forbidden" },
Expand Down
2 changes: 1 addition & 1 deletion lib/Basics/ResultT.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class ResultT {
bool ok() const { return _result.ok(); }
bool fail() const { return _result.fail(); }
bool is(ErrorCode code) { return _result.is(code); }
int errorNumber() const { return _result.errorNumber(); }
ErrorCode errorNumber() const { return _result.errorNumber(); }
[[nodiscard]] std::string_view errorMessage() const& { return _result.errorMessage(); }
[[nodiscard]] std::string errorMessage() && { return std::move(_result).errorMessage(); }

Expand Down
1 change: 1 addition & 0 deletions lib/Basics/errors.dat
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ERROR_ARANGO_ICU_ERROR,33,"icu error: %s","will be raised if icu operations fail
ERROR_CANNOT_READ_FILE,34,"cannot read file","Will be raised when a file cannot be read."
ERROR_INCOMPATIBLE_VERSION,35,"incompatible server version","Will be raised when a server is running an incompatible version of ArangoDB."
ERROR_DISABLED,36,"disabled","Will be raised when a requested resource is not enabled."
ERROR_MALFORMED_JSON,37,"malformed json","Will be raised when a JSON string could not be parsed."

################################################################################
## HTTP error status codes
Expand Down
1 change: 1 addition & 0 deletions lib/Basics/voc-errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void TRI_InitializeErrorMessages() {
REG_ERROR(ERROR_CANNOT_READ_FILE, "cannot read file");
REG_ERROR(ERROR_INCOMPATIBLE_VERSION, "incompatible server version");
REG_ERROR(ERROR_DISABLED, "disabled");
REG_ERROR(ERROR_MALFORMED_JSON, "malformed json");
REG_ERROR(ERROR_HTTP_BAD_PARAMETER, "bad parameter");
REG_ERROR(ERROR_HTTP_UNAUTHORIZED, "unauthorized");
REG_ERROR(ERROR_HTTP_FORBIDDEN, "forbidden");
Expand Down
Loading
0