aboutsummaryrefslogtreecommitdiff
path: root/src/database-redis.cpp
diff options
context:
space:
mode:
authornetinetwalker <manuel.hilbing@googlemail.com>2015-09-26 00:26:52 +0200
committerest31 <MTest31@outlook.com>2015-09-26 17:36:59 +0200
commit524a7656e3e5cd671b05c13e2ad69cb84bad0423 (patch)
tree0f7da732d102c6aeddb1184739b5fa6eb27e1534 /src/database-redis.cpp
parentf062bbd7a182233f96c61287d0397534811627d9 (diff)
downloadminetest-524a7656e3e5cd671b05c13e2ad69cb84bad0423.tar.gz
minetest-524a7656e3e5cd671b05c13e2ad69cb84bad0423.tar.bz2
minetest-524a7656e3e5cd671b05c13e2ad69cb84bad0423.zip
redis: throw error if block request failed
Fixes #3196. Before, we didn't throw an error, and the engine thought the block isn't occupied. But in fact it might be that redis is still loading, and the block does exist in the database. The result was a cheesy map.
Diffstat (limited to 'src/database-redis.cpp')
-rw-r--r--src/database-redis.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/database-redis.cpp b/src/database-redis.cpp
index cc4e5bade..d7f537977 100644
--- a/src/database-redis.cpp
+++ b/src/database-redis.cpp
@@ -118,12 +118,21 @@ std::string Database_Redis::loadBlock(const v3s16 &pos)
freeReplyObject(reply);
return str;
}
- case REDIS_REPLY_ERROR:
- errorstream << "WARNING: loadBlock: loading block " << PP(pos)
- << " failed: " << reply->str << std::endl;
+ case REDIS_REPLY_ERROR: {
+ std::string errstr = reply->str;
+ freeReplyObject(reply);
+ errorstream << "loadBlock: loading block " << PP(pos)
+ << " failed: " << errstr << std::endl;
+ throw FileNotGoodException(std::string(
+ "Redis command 'HGET %s %s' errored: ") + errstr);
+ }
}
+ errorstream << "loadBlock: loading block " << PP(pos)
+ << " returned invalid reply type " << reply->type
+ << ": " << reply->str << std::endl;
freeReplyObject(reply);
- return "";
+ throw FileNotGoodException(std::string(
+ "Redis command 'HGET %s %s' gave invalid reply."));
}
bool Database_Redis::deleteBlock(const v3s16 &pos)