mirror of
https://github.com/minetest/minetestmapper.git
synced 2024-11-22 15:33:49 +01:00
Better error reporting for Redis backend
This commit is contained in:
parent
2553e44e8d
commit
79d338a90c
@ -135,9 +135,10 @@ void DBRedis::loadPosCache()
|
|||||||
throw std::runtime_error("Failed to get keys from database");
|
throw std::runtime_error("Failed to get keys from database");
|
||||||
for(size_t i = 0; i < reply->elements; i++) {
|
for(size_t i = 0; i < reply->elements; i++) {
|
||||||
if(!reply->element[i]->type == REDIS_REPLY_STRING)
|
if(!reply->element[i]->type == REDIS_REPLY_STRING)
|
||||||
throw std::runtime_error("Got errornous response to 'HKEYS %s' command");
|
throw std::runtime_error("Got wrong response to 'HKEYS %s' command");
|
||||||
posCache.push_back(decodeBlockPos(stoi64(reply->element[i]->str)));
|
posCache.push_back(decodeBlockPos(stoi64(reply->element[i]->str)));
|
||||||
}
|
}
|
||||||
|
|
||||||
freeReplyObject(reply);
|
freeReplyObject(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +159,8 @@ void DBRedis::getBlocksOnZ(std::map<int16_t, BlockList> &blocks, int16_t zPos)
|
|||||||
if (reply->type == REDIS_REPLY_STRING && reply->len != 0) {
|
if (reply->type == REDIS_REPLY_STRING && reply->len != 0) {
|
||||||
Block b(*it, ustring((const unsigned char *) reply->str, reply->len));
|
Block b(*it, ustring((const unsigned char *) reply->str, reply->len));
|
||||||
blocks[b.first.x].push_back(b);
|
blocks[b.first.x].push_back(b);
|
||||||
}
|
} else
|
||||||
|
throw std::runtime_error("Got wrong response to 'HGET %s %s' command");
|
||||||
freeReplyObject(reply);
|
freeReplyObject(reply);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user