mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-01 20:32:25 +02:00
Add check if file creation was successful
This commit is contained in:
+11
-1
@@ -223,6 +223,15 @@ void H5Writer::create_file(hsize_t frame_chunk)
|
||||
#endif
|
||||
|
||||
file = H5::H5File(target_filename.c_str(), H5F_ACC_TRUNC);
|
||||
|
||||
if (file.getId() == -1) {
|
||||
stringstream error_message;
|
||||
using namespace date;
|
||||
error_message << "[" << std::chrono::system_clock::now() << "]";
|
||||
error_message << "Cannot create new file with filename " << target_filename << endl;
|
||||
|
||||
throw runtime_error(error_message.str());
|
||||
}
|
||||
|
||||
// New file created - set this files chunk number.
|
||||
current_frame_chunk = frame_chunk;
|
||||
@@ -303,4 +312,5 @@ H5::H5File& DummyH5Writer::get_h5_file(){
|
||||
error_message << "Cannot get the H5 file with the dummy writer." << endl;
|
||||
|
||||
throw runtime_error(error_message.str());
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user