mirror of https://gitee.com/bigwinds/arangodb
slighty improved error handling in import API
This commit is contained in:
parent
b7be5d5cfb
commit
226ed6d17a
|
@ -123,6 +123,11 @@ static void mergeResults(
|
||||||
resultBody->openArray();
|
resultBody->openArray();
|
||||||
for (auto const& pair : reverseMapping) {
|
for (auto const& pair : reverseMapping) {
|
||||||
VPackSlice arr = resultMap.find(pair.first)->second->slice();
|
VPackSlice arr = resultMap.find(pair.first)->second->slice();
|
||||||
|
if (arr.isObject() && arr.hasKey("error") && arr.get("error").isBoolean() && arr.get("error").getBoolean()) {
|
||||||
|
// an error occurred, now rethrow the error
|
||||||
|
int res = arr.get("errorNum").getNumericValue<int>();
|
||||||
|
THROW_ARANGO_EXCEPTION(res);
|
||||||
|
}
|
||||||
resultBody->add(arr.at(pair.second));
|
resultBody->add(arr.at(pair.second));
|
||||||
}
|
}
|
||||||
resultBody->close();
|
resultBody->close();
|
||||||
|
@ -736,6 +741,7 @@ int createDocumentOnCoordinator(
|
||||||
bool useMultiple = slice.isArray();
|
bool useMultiple = slice.isArray();
|
||||||
|
|
||||||
int res = TRI_ERROR_NO_ERROR;
|
int res = TRI_ERROR_NO_ERROR;
|
||||||
|
|
||||||
if (useMultiple) {
|
if (useMultiple) {
|
||||||
VPackValueLength length = slice.length();
|
VPackValueLength length = slice.length();
|
||||||
for (VPackValueLength idx = 0; idx < length; ++idx) {
|
for (VPackValueLength idx = 0; idx < length; ++idx) {
|
||||||
|
@ -766,6 +772,7 @@ int createDocumentOnCoordinator(
|
||||||
// Now prepare the requests:
|
// Now prepare the requests:
|
||||||
std::vector<ClusterCommRequest> requests;
|
std::vector<ClusterCommRequest> requests;
|
||||||
auto body = std::make_shared<std::string>();
|
auto body = std::make_shared<std::string>();
|
||||||
|
|
||||||
for (auto const& it : shardMap) {
|
for (auto const& it : shardMap) {
|
||||||
if (!useMultiple) {
|
if (!useMultiple) {
|
||||||
TRI_ASSERT(it.second.size() == 1);
|
TRI_ASSERT(it.second.size() == 1);
|
||||||
|
|
Loading…
Reference in New Issue