diff --git a/src/simplnx/DataStructure/IO/HDF5/DataArrayIO.hpp b/src/simplnx/DataStructure/IO/HDF5/DataArrayIO.hpp index ef113121af..f37c359352 100644 --- a/src/simplnx/DataStructure/IO/HDF5/DataArrayIO.hpp +++ b/src/simplnx/DataStructure/IO/HDF5/DataArrayIO.hpp @@ -64,21 +64,21 @@ class DataArrayIO : public IDataIO auto datasetReader = parentGroup.openDataset(dataArrayName); if(!datasetReader.isValid()) { - std::string ss = "Could not open Dataset"; + std::string ss = fmt::format("Could not open data set '{}' which is a child of '{}'", dataArrayName, parentGroup.getName()); return MakeErrorResult(-900, ss); } nx::core::HDF5::Type type = datasetReader.getType(); if(type == nx::core::HDF5::Type::unknown) { - std::string ss = "Invalid Dataset data type"; + std::string ss = fmt::format("Invalid Dataset data type for DataArray '{}' which is a child of '{}'", dataArrayName, parentGroup.getName()); return MakeErrorResult(-901, ss); } auto dataTypeAttribute = datasetReader.getAttribute(Constants::k_ObjectTypeTag); const bool isBoolArray = (dataTypeAttribute.isValid() && dataTypeAttribute.readAsString().compare("DataArray") == 0); - // Check importablility + // Check ability to import the data auto importableAttribute = datasetReader.getAttribute(Constants::k_ImportableTag); if(importableAttribute.isValid() && importableAttribute.readAsValue() == 0) { @@ -133,8 +133,7 @@ class DataArrayIO : public IDataIO if(err < 0) { - std::string ss = "Error importing DataArray"; - return MakeErrorResult(err, ss); + return MakeErrorResult(err, fmt::format("Error importing dataset from HDF5 file. DataArray name '{}' that is a child of '{}'", dataArrayName, parentGroup.getName())); } return {}; diff --git a/src/simplnx/DataStructure/IO/HDF5/StringArrayIO.cpp b/src/simplnx/DataStructure/IO/HDF5/StringArrayIO.cpp index 01846d8993..caf98fe14a 100644 --- a/src/simplnx/DataStructure/IO/HDF5/StringArrayIO.cpp +++ b/src/simplnx/DataStructure/IO/HDF5/StringArrayIO.cpp @@ -31,7 +31,7 @@ Result<> StringArrayIO::readData(DataStructureReader& dataStructureReader, const auto datasetReader = parentGroup.openDataset(objectName); std::string dataArrayName = datasetReader.getName(); - // Check importablility + // Check ability to import the data auto importableAttribute = datasetReader.getAttribute(Constants::k_ImportableTag); if(importableAttribute.isValid() && importableAttribute.readAsValue() == 0) { @@ -46,8 +46,7 @@ Result<> StringArrayIO::readData(DataStructureReader& dataStructureReader, const if(data == nullptr) { - std::string ss = "Error importing DataArray"; - return MakeErrorResult(-404, ss); + return MakeErrorResult(-404, fmt::format("Error importing DataArray with name '{}' that is a child of group '{}'", dataArrayName, parentGroup.getName())); } return {}; @@ -71,7 +70,8 @@ Result<> StringArrayIO::writeData(DataStructureWriter& dataStructureWriter, cons result = tupleDimsAttribWriter.writeValue(dataArray.size()); if(result.invalid()) { - std::string ss = fmt::format("Error writing DataObject attribute: {}", k_TupleDimsAttrName); + std::string ss = + fmt::format("Error writing DataObject attribute: {} for DataArray with name '{}' which has a parent named '{}'", k_TupleDimsAttrName, dataArray.getName(), parentGroup.getName()); return MakeErrorResult(result.errors()[0].code, ss); } } diff --git a/src/simplnx/DataStructure/IO/HDF5/StringArrayIO.hpp b/src/simplnx/DataStructure/IO/HDF5/StringArrayIO.hpp index cd2d1184c4..5929a03a01 100644 --- a/src/simplnx/DataStructure/IO/HDF5/StringArrayIO.hpp +++ b/src/simplnx/DataStructure/IO/HDF5/StringArrayIO.hpp @@ -17,7 +17,7 @@ class SIMPLNX_EXPORT StringArrayIO : public IDataIO using data_type = StringArray; StringArrayIO(); - virtual ~StringArrayIO() noexcept; + ~StringArrayIO() noexcept override; StringArrayIO(const StringArrayIO& other) = delete; StringArrayIO(StringArrayIO&& other) = delete; @@ -36,7 +36,7 @@ class SIMPLNX_EXPORT StringArrayIO : public IDataIO * @return Result<> */ Result<> readData(DataStructureReader& dataStructureReader, const group_reader_type& parentGroup, const std::string& arrayName, DataObject::IdType importId, - const std::optional& parentId, bool useEmptyDataStore = false) const override; + const std::optional& parentId, bool useEmptyDataStore) const override; /** * @brief Attempts to write an StringArray to HDF5.