Commit 805c760 1 parent 9e53e9a commit 805c760 Copy full SHA for 805c760
File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 29
29
#include < iostream>
30
30
#include < set>
31
31
#include < sstream>
32
+ #include < stdexcept>
32
33
33
34
namespace openPMD
34
35
{
@@ -126,8 +127,17 @@ Series Attributable::retrieveSeries() const
126
127
{
127
128
findSeries = findSeries->parent ;
128
129
}
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
+ }
131
141
Series res;
132
142
res.setData (
133
143
std::shared_ptr<internal::SeriesData>{seriesData, [](auto const *) {}});
You can’t perform that action at this time.
0 commit comments