diff --git a/include/openPMD/Error.hpp b/include/openPMD/Error.hpp
index c6222f5af8..2b8c727e16 100644
--- a/include/openPMD/Error.hpp
+++ b/include/openPMD/Error.hpp
@@ -95,6 +95,7 @@ namespace error
NotFound,
CannotRead,
UnexpectedContent,
+ Inaccessible,
Other
};
diff --git a/src/Iteration.cpp b/src/Iteration.cpp
index 498f3d069c..0f68e17ddb 100644
--- a/src/Iteration.cpp
+++ b/src/Iteration.cpp
@@ -572,6 +572,17 @@ void Iteration::readMeshes(std::string const &meshesPath)
mrc.get().m_isConstant = true;
}
m.read();
+ try
+ {
+ m.read();
+ }
+ catch (error::ReadError const &err)
+ {
+ std::cerr << "Cannot read mesh with name '" << mesh_name
+ << "' and will skip it due to read error:\n"
+ << err.what() << std::endl;
+ map.forget(mesh_name);
+ }
}
/* obtain all scalar meshes */
@@ -593,7 +604,17 @@ void Iteration::readMeshes(std::string const &meshesPath)
mrc.written() = false;
mrc.resetDataset(Dataset(*dOpen.dtype, *dOpen.extent));
mrc.written() = true;
- m.read();
+ try
+ {
+ m.read();
+ }
+ catch (error::ReadError const &err)
+ {
+ std::cerr << "Cannot read mesh with name '" << mesh_name
+ << "' and will skip it due to read error:\n"
+ << err.what() << std::endl;
+ map.forget(mesh_name);
+ }
}
}
@@ -619,7 +640,18 @@ void Iteration::readParticles(std::string const &particlesPath)
pOpen.path = species_name;
IOHandler()->enqueue(IOTask(&p, pOpen));
IOHandler()->flush(internal::defaultFlushParams);
- p.read();
+ try
+ {
+ p.read();
+ }
+ catch (error::ReadError const &err)
+ {
+ std::cerr << "Cannot read particle species with name '"
+ << species_name
+ << "' and will skip it due to read error:\n"
+ << err.what() << std::endl;
+ map.forget(species_name);
+ }
}
}
diff --git a/src/Mesh.cpp b/src/Mesh.cpp
index b90ea0b792..24cf63ec11 100644
--- a/src/Mesh.cpp
+++ b/src/Mesh.cpp
@@ -18,7 +18,9 @@
* and the GNU Lesser General Public License along with openPMD-api.
* If not, see .
*/
+
#include "openPMD/Mesh.hpp"
+#include "openPMD/Error.hpp"
#include "openPMD/Series.hpp"
#include "openPMD/auxiliary/DerefDynamicCast.hpp"
#include "openPMD/auxiliary/StringManip.hpp"
@@ -294,7 +296,10 @@ void Mesh::read()
setGeometry(tmpGeometry);
}
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'geometry'");
aRead.name = "dataOrder";
@@ -310,11 +315,17 @@ void Mesh::read()
if (tmpDataOrder.size() == 1)
setDataOrder(static_cast(tmpDataOrder[0]));
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute value for 'dataOrder': " + tmpDataOrder);
}
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'dataOrder'");
aRead.name = "axisLabels";
@@ -324,7 +335,10 @@ void Mesh::read()
setAxisLabels(
Attribute(*aRead.resource).get >());
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'axisLabels'");
aRead.name = "gridSpacing";
@@ -339,7 +353,10 @@ void Mesh::read()
*aRead.dtype == DT::VEC_LONG_DOUBLE || *aRead.dtype == DT::LONG_DOUBLE)
setGridSpacing(a.get >());
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'gridSpacing'");
aRead.name = "gridGlobalOffset";
@@ -349,7 +366,10 @@ void Mesh::read()
setGridGlobalOffset(
Attribute(*aRead.resource).get >());
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'gridGlobalOffset'");
aRead.name = "gridUnitSI";
@@ -358,7 +378,10 @@ void Mesh::read()
if (*aRead.dtype == DT::DOUBLE)
setGridUnitSI(Attribute(*aRead.resource).get());
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'gridUnitSI'");
if (scalar())
diff --git a/src/ParticlePatches.cpp b/src/ParticlePatches.cpp
index 76017bbf94..5722ccddd5 100644
--- a/src/ParticlePatches.cpp
+++ b/src/ParticlePatches.cpp
@@ -18,7 +18,9 @@
* and the GNU Lesser General Public License along with openPMD-api.
* If not, see .
*/
+
#include "openPMD/ParticlePatches.hpp"
+#include "openPMD/Error.hpp"
namespace openPMD
{
@@ -43,7 +45,17 @@ void ParticlePatches::read()
PatchRecord &pr = (*this)[record_name];
pOpen.path = record_name;
IOHandler()->enqueue(IOTask(&pr, pOpen));
- pr.read();
+ try
+ {
+ pr.read();
+ }
+ catch (error::ReadError const &err)
+ {
+ std::cerr << "Cannot read patch record '" << record_name
+ << "' due to read error and will skip it:" << err.what()
+ << std::endl;
+ this->container().erase(record_name);
+ }
}
Parameter dList;
@@ -55,9 +67,13 @@ void ParticlePatches::read()
{
if (!("numParticles" == component_name ||
"numParticlesOffset" == component_name))
- throw std::runtime_error(
- "Unexpected record component" + component_name +
- "in particlePatch");
+ {
+
+ std::cerr << "Unexpected record component" + component_name +
+ "in particlePatch. Will ignore it."
+ << std::endl;
+ continue;
+ }
PatchRecord &pr = Container::operator[](component_name);
PatchRecordComponent &prc = pr[RecordComponent::SCALAR];
@@ -68,7 +84,10 @@ void ParticlePatches::read()
IOHandler()->flush(internal::defaultFlushParams);
if (determineDatatype() != *dOpen.dtype)
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected datatype for " + component_name);
/* allow all attributes to be set */
@@ -77,7 +96,18 @@ void ParticlePatches::read()
prc.written() = true;
pr.dirty() = false;
- prc.read();
+ try
+ {
+ prc.read();
+ }
+ catch (error::ReadError const &err)
+ {
+ std::cerr
+ << "Cannot read record component '" << component_name
+ << "' in particle patch and will skip it due to read error:\n"
+ << err.what() << std::endl;
+ Container::container().erase(component_name);
+ }
}
}
} // namespace openPMD
diff --git a/src/ParticleSpecies.cpp b/src/ParticleSpecies.cpp
index 1bf9f90661..903cd236d2 100644
--- a/src/ParticleSpecies.cpp
+++ b/src/ParticleSpecies.cpp
@@ -52,7 +52,17 @@ void ParticleSpecies::read()
hasParticlePatches = true;
pOpen.path = "particlePatches";
IOHandler()->enqueue(IOTask(&particlePatches, pOpen));
- particlePatches.read();
+ try
+ {
+ particlePatches.read();
+ }
+ catch (error::ReadError const &err)
+ {
+ std::cerr << "Cannot read particle patches and will skip them "
+ "due to read error:\n"
+ << err.what() << std::endl;
+ hasParticlePatches = false;
+ }
}
else
{
@@ -76,7 +86,20 @@ void ParticleSpecies::read()
IOHandler()->flush(internal::defaultFlushParams);
rc.get().m_isConstant = true;
}
- r.read();
+ try
+ {
+ r.read();
+ }
+ catch (error::ReadError const &err)
+ {
+ std::cerr << "Cannot read particle record '" << record_name
+ << "' and will skip it due to read error:\n"
+ << err.what() << std::endl;
+
+ map.forget(record_name);
+ //(*this)[record_name].erase(RecordComponent::SCALAR);
+ // this->erase(record_name);
+ }
}
}
diff --git a/src/Record.cpp b/src/Record.cpp
index 21d0596dc8..e9967af024 100644
--- a/src/Record.cpp
+++ b/src/Record.cpp
@@ -104,7 +104,18 @@ void Record::read()
if (scalar())
{
/* using operator[] will incorrectly update parent */
- this->at(RecordComponent::SCALAR).read();
+ auto &scalarComponent = this->at(RecordComponent::SCALAR);
+ try
+ {
+ scalarComponent.read();
+ }
+ catch (error::ReadError const &err)
+ {
+ std::cerr << "Cannot read scalar record component and will skip it "
+ "due to read error:\n"
+ << err.what() << std::endl;
+ this->container().erase(RecordComponent::SCALAR);
+ }
}
else
{
diff --git a/src/RecordComponent.cpp b/src/RecordComponent.cpp
index 9e7a93e6ea..531ba95f24 100644
--- a/src/RecordComponent.cpp
+++ b/src/RecordComponent.cpp
@@ -356,7 +356,11 @@ void RecordComponent::readBase()
makeConstant(a.get());
break;
default:
- throw std::runtime_error("Unexpected constant datatype");
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
+ "Unexpected constant datatype");
}
written() = true;
@@ -378,7 +382,11 @@ void RecordComponent::readBase()
oss << "Unexpected datatype (" << *aRead.dtype
<< ") for attribute 'shape' (" << determineDatatype()
<< " aka uint64_t)";
- throw std::runtime_error(oss.str());
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
+ oss.str());
}
written() = false;
@@ -392,7 +400,11 @@ void RecordComponent::readBase()
if (*aRead.dtype == DT::DOUBLE)
setUnitSI(Attribute(*aRead.resource).get());
else
- throw std::runtime_error("Unexpected Attribute datatype for 'unitSI'");
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
+ "Unexpected Attribute datatype for 'unitSI'");
readAttributes(ReadMode::FullyReread);
}
diff --git a/src/Series.cpp b/src/Series.cpp
index 685c972f7d..2eea1f4d56 100644
--- a/src/Series.cpp
+++ b/src/Series.cpp
@@ -918,7 +918,10 @@ void Series::readFileBased()
fOpen.encoding = iterationEncoding();
if (!auxiliary::directory_exists(IOHandler()->directory))
- throw no_such_file_error(
+ throw error::ReadError(
+ error::AffectedObject::Other,
+ error::Reason::Inaccessible,
+ {},
"Supplied directory is not valid: " + IOHandler()->directory);
auto isPartOfSeries = matcher(
@@ -942,7 +945,11 @@ void Series::readFileBased()
* parameter modification. Backend access type stays unchanged for the
* lifetime of a Series. */
if (IOHandler()->m_backendAccess == Access::READ_ONLY)
- throw no_such_file_error("No matching iterations found: " + name());
+ throw error::ReadError(
+ error::AffectedObject::Other,
+ error::Reason::Inaccessible,
+ {},
+ "No matching iterations found: " + name());
else
std::cerr << "No matching iterations found: " << name()
<< std::endl;
@@ -994,7 +1001,10 @@ void Series::readFileBased()
}
if (!atLeastOneIterationSuccessful)
{
- throw error::ParseError(
+ throw error::ReadError(
+ error::AffectedObject::Other,
+ error::Reason::Other,
+ {},
"Not a single iteration can be successfully parsed (see above "
"errors). Need to access at least one iteration even in "
"deferred parsing mode in order to read global Series "
@@ -1020,7 +1030,10 @@ void Series::readFileBased()
}
if (!atLeastOneIterationSuccessful)
{
- throw error::ParseError(
+ throw error::ReadError(
+ error::AffectedObject::Other,
+ error::Reason::Other,
+ {},
"Not a single iteration can be successfully parsed (see above "
"warnings).");
}
@@ -1082,14 +1095,21 @@ void Series::readOneIterationFileBased(std::string const &filePath)
* Unlike if the file were group-based, this one doesn't work
* at all since the group paths are different.
*/
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Other,
+ error::Reason::Other,
+ {},
"Series constructor called with iteration "
"regex '%T' suggests loading a "
"time series with fileBased iteration "
"encoding. Loaded file is variableBased.");
}
else
- throw std::runtime_error("Unknown iterationEncoding: " + encoding);
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
+ "Unknown iterationEncoding: " + encoding);
setAttribute("iterationEncoding", encoding);
}
else
@@ -1107,7 +1127,10 @@ void Series::readOneIterationFileBased(std::string const &filePath)
written() = true;
}
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'iterationFormat'");
Parameter pOpen;
@@ -1163,12 +1186,18 @@ std::optional > Series::readGorVBased(bool do_init)
series.m_overrideFilebasedFilename = series.m_name;
}
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unknown iterationEncoding: " + encoding);
setAttribute("iterationEncoding", encoding);
}
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'iterationEncoding'");
aRead.name = "iterationFormat";
@@ -1181,7 +1210,10 @@ std::optional > Series::readGorVBased(bool do_init)
written() = true;
}
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'iterationFormat'");
}
@@ -1190,7 +1222,11 @@ std::optional > Series::readGorVBased(bool do_init)
if (version == "1.0.0" || version == "1.0.1" || version == "1.1.0")
pOpen.path = auxiliary::replace_first(basePath(), "/%T/", "");
else
- throw std::runtime_error("Unknown openPMD version - " + version);
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
+ "Unknown openPMD version - " + version);
IOHandler()->enqueue(IOTask(&series.iterations, pOpen));
readAttributes(ReadMode::IgnoreExisting);
@@ -1312,7 +1348,11 @@ std::optional > Series::readGorVBased(bool do_init)
std::stringstream s;
s << "Unexpected datatype for '/data/snapshot': "
<< attribute.dtype << std::endl;
- throw std::runtime_error(s.str());
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
+ s.str());
}
}
}
@@ -1397,7 +1437,11 @@ void Series::readBase()
if (*aRead.dtype == DT::STRING)
setOpenPMD(Attribute(*aRead.resource).get());
else
- throw std::runtime_error("Unexpected Attribute datatype for 'openPMD'");
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
+ "Unexpected Attribute datatype for 'openPMD'");
aRead.name = "openPMDextension";
IOHandler()->enqueue(IOTask(this, aRead));
@@ -1405,7 +1449,10 @@ void Series::readBase()
if (*aRead.dtype == determineDatatype())
setOpenPMDextension(Attribute(*aRead.resource).get());
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'openPMDextension'");
aRead.name = "basePath";
@@ -1414,7 +1461,10 @@ void Series::readBase()
if (*aRead.dtype == DT::STRING)
setAttribute("basePath", Attribute(*aRead.resource).get());
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'basePath'");
Parameter aList;
@@ -1439,7 +1489,10 @@ void Series::readBase()
it.second.meshes.written() = true;
}
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'meshesPath'");
}
@@ -1463,7 +1516,10 @@ void Series::readBase()
it.second.particles.written() = true;
}
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'particlesPath'");
}
}
diff --git a/src/backend/Attributable.cpp b/src/backend/Attributable.cpp
index b73c850409..69e1c5ddc4 100644
--- a/src/backend/Attributable.cpp
+++ b/src/backend/Attributable.cpp
@@ -299,7 +299,10 @@ void Attributable::readAttributes(ReadMode mode)
// Some backends may report the wrong type when reading
if (vector.size() != 7)
{
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"[Attributable] "
"Unexpected datatype for unitDimension.");
}
@@ -529,7 +532,11 @@ void Attributable::readAttributes(ReadMode mode)
internal::SetAttributeMode::WhileReadingAttributes);
break;
case DT::UNDEFINED:
- throw std::runtime_error("Invalid Attribute datatype during read");
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
+ "Invalid Attribute datatype during read");
}
}
diff --git a/src/backend/MeshRecordComponent.cpp b/src/backend/MeshRecordComponent.cpp
index 9602868a07..a3b29a705f 100644
--- a/src/backend/MeshRecordComponent.cpp
+++ b/src/backend/MeshRecordComponent.cpp
@@ -44,7 +44,10 @@ void MeshRecordComponent::read()
*aRead.dtype == DT::VEC_LONG_DOUBLE || *aRead.dtype == DT::LONG_DOUBLE)
setPosition(a.get >());
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'position'");
readBase();
diff --git a/src/backend/PatchRecord.cpp b/src/backend/PatchRecord.cpp
index f31b135b62..bf29ec4ba7 100644
--- a/src/backend/PatchRecord.cpp
+++ b/src/backend/PatchRecord.cpp
@@ -69,7 +69,10 @@ void PatchRecord::read()
"unitDimension",
Attribute(*aRead.resource).template get >());
else
- throw std::runtime_error(
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
"Unexpected Attribute datatype for 'unitDimension'");
Parameter dList;
@@ -87,7 +90,18 @@ void PatchRecord::read()
prc.written() = false;
prc.resetDataset(Dataset(*dOpen.dtype, *dOpen.extent));
prc.written() = true;
- prc.read();
+ try
+ {
+ prc.read();
+ }
+ catch (error::ReadError const &err)
+ {
+ std::cerr << "Cannot read patch record component '"
+ << component_name
+ << "' and will skip it due to read error:" << err.what()
+ << std::endl;
+ this->container().erase(component_name);
+ }
}
dirty() = false;
}
diff --git a/src/backend/PatchRecordComponent.cpp b/src/backend/PatchRecordComponent.cpp
index a5178a9911..0b53de09ed 100644
--- a/src/backend/PatchRecordComponent.cpp
+++ b/src/backend/PatchRecordComponent.cpp
@@ -129,7 +129,11 @@ void PatchRecordComponent::read()
if (*aRead.dtype == Datatype::DOUBLE)
setUnitSI(Attribute(*aRead.resource).get());
else
- throw std::runtime_error("Unexpected Attribute datatype for 'unitSI'");
+ throw error::ReadError(
+ error::AffectedObject::Attribute,
+ error::Reason::UnexpectedContent,
+ {},
+ "Unexpected Attribute datatype for 'unitSI'");
readAttributes(ReadMode::FullyReread); // this will set dirty() = false
}
diff --git a/test/ParallelIOTest.cpp b/test/ParallelIOTest.cpp
index 4f9c2acb3c..df9b47b531 100644
--- a/test/ParallelIOTest.cpp
+++ b/test/ParallelIOTest.cpp
@@ -271,10 +271,14 @@ TEST_CASE("git_hdf5_sample_content_test", "[parallel][hdf5]")
REQUIRE(raw_ptr[i] == constant_value);
}
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "git sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "git sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
+ throw;
}
}
@@ -607,10 +611,14 @@ TEST_CASE("hzdr_adios_sample_content_test", "[parallel][adios1]")
REQUIRE(raw_ptr[j * 3 + k] == actual[rank][j][k]);
}
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "git sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "git sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
+ throw;
}
}
#endif
diff --git a/test/SerialIOTest.cpp b/test/SerialIOTest.cpp
index f3084113c4..3c89ef31d9 100644
--- a/test/SerialIOTest.cpp
+++ b/test/SerialIOTest.cpp
@@ -2334,9 +2334,16 @@ inline void optional_paths_110_test(const std::string &backend)
REQUIRE(s.iterations[400].particles.empty());
}
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "issue sample not accessible. (" << e.what() << ")\n";
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "issue sample not accessible. (" << e.what() << ")\n";
+ }
+ else
+ {
+ throw;
+ }
}
{
@@ -2405,10 +2412,14 @@ void git_early_chunk_query(
}
}
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "git sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "git sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
+ throw;
}
}
@@ -2445,9 +2456,16 @@ TEST_CASE("empty_alternate_fbpic", "[serial][hdf5]")
helper::listSeries(list);
}
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "issue sample not accessible. (" << e.what() << ")\n";
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "issue sample not accessible. (" << e.what() << ")\n";
+ }
+ else
+ {
+ throw;
+ }
}
}
@@ -2634,10 +2652,14 @@ TEST_CASE("git_hdf5_sample_structure_test", "[serial][hdf5]")
int32_t i32 = 32;
REQUIRE_THROWS(o.setAttribute("setAttributeFail", i32));
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "git sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "git sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
+ throw;
}
#else
std::cerr << "Invasive tests not enabled. Hierarchy is not visible.\n";
@@ -2891,10 +2913,14 @@ TEST_CASE("git_hdf5_sample_attribute_test", "[serial][hdf5]")
REQUIRE(weighting_scalar.getDimensionality() == 1);
REQUIRE(weighting_scalar.getExtent() == e);
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "git sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "git sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
+ throw;
}
}
@@ -2965,10 +2991,14 @@ TEST_CASE("git_hdf5_sample_content_test", "[serial][hdf5]")
REQUIRE(raw_ptr[i] == constant_value);
}
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "git sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "git sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
+ throw;
}
}
@@ -2989,10 +3019,14 @@ TEST_CASE("git_hdf5_sample_fileBased_read_test", "[serial][hdf5]")
REQUIRE(o.get().m_filenamePadding == 8);
#endif
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "git sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "git sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
+ throw;
}
try
@@ -3011,15 +3045,19 @@ TEST_CASE("git_hdf5_sample_fileBased_read_test", "[serial][hdf5]")
REQUIRE(o.get().m_filenamePadding == 8);
#endif
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "git sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "git sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
+ throw;
}
- REQUIRE_THROWS_WITH(
+ REQUIRE_THROWS_AS(
Series("../samples/git-sample/data%07T.h5", Access::READ_ONLY),
- Catch::Equals("No matching iterations found: data%07T"));
+ error::ReadError);
try
{
@@ -3056,10 +3094,14 @@ TEST_CASE("git_hdf5_sample_fileBased_read_test", "[serial][hdf5]")
auxiliary::remove_file(file);
}
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "git sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "git sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
+ throw;
}
}
@@ -3136,10 +3178,14 @@ TEST_CASE("git_hdf5_sample_read_thetaMode", "[serial][hdf5][thetaMode]")
auto data = B_z.loadChunk(offset, extent);
o.flush();
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "git sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "git sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
+ throw;
}
}
@@ -3609,10 +3655,13 @@ TEST_CASE("hzdr_hdf5_sample_content_test", "[serial][hdf5]")
REQUIRE(
isSame(e_offset_z.getDatatype(), determineDatatype()));
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "HZDR sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "HZDR sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
}
}
@@ -3803,10 +3852,13 @@ TEST_CASE("hzdr_adios1_sample_content_test", "[serial][adios1]")
for (int c = 0; c < 3; ++c)
REQUIRE(raw_ptr[((a * 3) + b) * 3 + c] == actual[a][b][c]);
}
- catch (no_such_file_error &e)
+ catch (error::ReadError &e)
{
- std::cerr << "HZDR sample not accessible. (" << e.what() << ")\n";
- return;
+ if (e.reason == error::Reason::Inaccessible)
+ {
+ std::cerr << "HZDR sample not accessible. (" << e.what() << ")\n";
+ return;
+ }
}
}