File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 2929#include < iostream>
3030#include < set>
3131#include < sstream>
32+ #include < stdexcept>
3233
3334namespace openPMD
3435{
@@ -126,8 +127,17 @@ Series Attributable::retrieveSeries() const
126127 {
127128 findSeries = findSeries->parent ;
128129 }
129- auto seriesData = &auxiliary::deref_dynamic_cast<internal::SeriesData>(
130- findSeries->attributable );
130+ auto *seriesData =
131+ dynamic_cast <internal::SeriesData *>(findSeries->attributable );
132+ if (!seriesData)
133+ {
134+ throw std::runtime_error (
135+ " [Attributable::retrieveSeries] Error when trying to retrieve the "
136+ " Series object. Note: An instance of the Series object must still "
137+ " exist when flushing. A common cause for this error is using a "
138+ " flush call on a handle (e.g. `Iteration::seriesFlush()`) when the "
139+ " original Series object has already gone out of scope." );
140+ }
131141 Series res;
132142 res.setData (
133143 std::shared_ptr<internal::SeriesData>{seriesData, [](auto const *) {}});
You can’t perform that action at this time.
0 commit comments