introduce checksum_exception

This commit is contained in:
Joe Thornber
2012-02-27 14:07:16 +00:00
parent d4a3e56d54
commit a4b41e90ad
6 changed files with 127 additions and 9 deletions

View File

@@ -18,11 +18,13 @@
#include "btree.h"
#include "errors.h"
#include "checksum.h"
#include "transaction_manager.h"
#include <iostream>
using namespace base;
using namespace btree_detail;
using namespace persistent_data;
using namespace std;
@@ -37,10 +39,10 @@ namespace {
crc32c sum(BTREE_CSUM_XOR);
sum.append(&n->flags, MD_BLOCK_SIZE - sizeof(uint32_t));
if (sum.get_sum() != to_cpu<uint32_t>(n->csum))
throw runtime_error("bad checksum in btree node");
throw checksum_error("bad checksum in btree node");
if (to_cpu<uint64_t>(n->blocknr) != location)
throw runtime_error("bad block nr in btree node");
throw checksum_error("bad block nr in btree node");
}
virtual void prepare(block_manager<>::buffer &b, block_address location) const {