Skip to content

Commit 1b8360c

Browse files
committed
Better error message when calling readIterations() too late
1 parent 831cf20 commit 1b8360c

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/ReadIterations.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ SeriesIterator::SeriesIterator(Series series) : m_series(std::move(series))
3737
*this = end();
3838
return;
3939
}
40+
else if (
41+
it->second.get().m_closed == internal::CloseStatus::ClosedInBackend)
42+
{
43+
throw error::WrongAPIUsage(
44+
"Trying to call Series::readIterations() on a (partially) read "
45+
"Series.");
46+
}
4047
else
4148
{
4249
auto openIteration = [](Iteration &iteration) {

test/SerialIOTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5645,8 +5645,7 @@ void append_mode(
56455645
}
56465646
REQUIRE(counter == 5);
56475647
// Cannot do listSeries here because the Series is already drained
5648-
// @todo better error message if attempting this
5649-
// helper::listSeries( read );
5648+
REQUIRE_THROWS_AS(helper::listSeries(read), error::WrongAPIUsage);
56505649
}
56515650
else
56525651
{

0 commit comments

Comments
 (0)