From e5f969817e6c11f3366399f679279d3c17b31623 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Tue, 14 Jun 2016 14:27:22 +0100 Subject: [PATCH] [block cache] improve exception message --- block-cache/block_cache.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block-cache/block_cache.cc b/block-cache/block_cache.cc index 16e355c..98460d9 100644 --- a/block-cache/block_cache.cc +++ b/block-cache/block_cache.cc @@ -525,8 +525,11 @@ block_cache::get(block_address index, unsigned flags, validator::ptr v) block *b = lookup_or_read_block(index, flags, v); if (b) { - if (b->ref_count_ && flags & (GF_DIRTY | GF_ZERO)) - throw std::runtime_error("attempt to write lock block concurrently"); + if (b->ref_count_ && (flags & (GF_DIRTY | GF_ZERO))) { + std::ostringstream out; + out << "attempt to write lock block " << index << " concurrently"; + throw std::runtime_error(out.str()); + } // FIXME: this gets called even for new blocks hit(*b);