Show the block address in exception string
This commit is contained in:
parent
b1d4b9f7c8
commit
d2260dee34
@ -90,14 +90,22 @@ namespace persistent_data {
|
|||||||
{
|
{
|
||||||
uint32_t flags = to_cpu<uint32_t>(raw_->header.flags);
|
uint32_t flags = to_cpu<uint32_t>(raw_->header.flags);
|
||||||
if (flags & INTERNAL_NODE) {
|
if (flags & INTERNAL_NODE) {
|
||||||
if (flags & LEAF_NODE)
|
if (flags & LEAF_NODE) {
|
||||||
throw runtime_error("btree node is both internal and leaf");
|
ostringstream out;
|
||||||
|
out << "btree node is both internal and leaf"
|
||||||
|
<< " (block " << location_ << ")";
|
||||||
|
throw runtime_error(out.str());
|
||||||
|
}
|
||||||
return INTERNAL;
|
return INTERNAL;
|
||||||
|
|
||||||
} else if (flags & LEAF_NODE)
|
} else if (flags & LEAF_NODE)
|
||||||
return LEAF;
|
return LEAF;
|
||||||
else
|
else {
|
||||||
throw runtime_error("unknown node type");
|
ostringstream out;
|
||||||
|
out << "unknown node type"
|
||||||
|
<< " (block " << location_ << ")";
|
||||||
|
throw runtime_error(out.str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ValueTraits>
|
template <typename ValueTraits>
|
||||||
@ -352,7 +360,8 @@ namespace persistent_data {
|
|||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "value size mismatch: expected " << sizeof(typename ValueTraits::disk_type)
|
out << "value size mismatch: expected " << sizeof(typename ValueTraits::disk_type)
|
||||||
<< ", but got " << get_value_size()
|
<< ", but got " << get_value_size()
|
||||||
<< ". This is not the btree you are looking for." << std::endl;
|
<< ". This is not the btree you are looking for."
|
||||||
|
<< " (block " << location_ << ")" << std::endl;
|
||||||
|
|
||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
@ -371,7 +380,8 @@ namespace persistent_data {
|
|||||||
if (max < get_nr_entries()) {
|
if (max < get_nr_entries()) {
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "Bad nr of elements: max per block = "
|
out << "Bad nr of elements: max per block = "
|
||||||
<< max << ", actual = " << get_nr_entries() << std::endl;
|
<< max << ", actual = " << get_nr_entries()
|
||||||
|
<< " (block " << location_ << ")" << std::endl;
|
||||||
throw std::runtime_error(out.str());
|
throw std::runtime_error(out.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user