From b07033d50174dbe925f299f57ff75309c86c6df3 Mon Sep 17 00:00:00 2001 From: Seok Namkoong Date: Fri, 11 Sep 2020 12:58:58 +0900 Subject: [PATCH] [release/1.9.0][record-minmax] Handling error when data file is not HDF5 (#4204) * [release/1.9.0][record-minmax] Handling error when data file is not HDF5 This commit will add error handling code when data file is not HDF5. ONE-DCO-1.0-Signed-off-by: Seok NamKoong * revise msg * revise 2 --- compiler/record-minmax/src/HDF5Importer.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/record-minmax/src/HDF5Importer.h b/compiler/record-minmax/src/HDF5Importer.h index cf652668595..101ce58a21f 100644 --- a/compiler/record-minmax/src/HDF5Importer.h +++ b/compiler/record-minmax/src/HDF5Importer.h @@ -39,9 +39,12 @@ namespace record_minmax class HDF5Importer { public: - explicit HDF5Importer(const std::string &path) : _file{path, H5F_ACC_RDONLY} + explicit HDF5Importer(const std::string &path) { - // Do nothing + if (_file.isHdf5(path) == false) + throw std::runtime_error("Error: Given data file is not HDF5"); + + _file = H5::H5File(path, H5F_ACC_RDONLY); } public: