Skip to content

Commit 9349396

Browse files
committed
Better error message when calling readIterations() too late
1 parent 6b76a70 commit 9349396

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/ReadIterations.cpp

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

test/SerialIOTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5086,8 +5086,8 @@ void append_mode(
50865086
}
50875087
REQUIRE( counter == 5 );
50885088
// Cannot do listSeries here because the Series is already drained
5089-
// @todo better error message if attempting this
5090-
// helper::listSeries( read );
5089+
REQUIRE_THROWS_AS(
5090+
helper::listSeries( read ), error::WrongAPIUsage );
50915091
}
50925092
else
50935093
{

0 commit comments

Comments
 (0)