Skip to content
Snippets Groups Projects
Commit e9244e0e authored by Andre Offringa's avatar Andre Offringa
Browse files

Reduce and correct LOBES warnings

parent 5b998229
No related branches found
No related tags found
No related merge requests found
Pipeline #43498 passed
......@@ -31,10 +31,15 @@ std::shared_ptr<const ElementResponse> ElementResponse::GetInstance(
try {
return LOBESElementResponse::GetInstance(name, options);
} catch (const std::runtime_error& e) {
static bool first_time = true;
if (first_time) {
std::cout << "Creating LOBESElementResponse for station " << name
<< " failed because: " << std::endl;
std::cout << e.what() << std::endl;
std::cout << "Switching to HamakerElementResponse instead" << std::endl;
<< " failed because: \n"
<< e.what() << '\n'
<< "Switching to HamakerElementResponse instead. Further "
"warnings of this type will be suppressed.\n";
first_time = false;
}
return std::make_shared<HamakerElementResponse>(name);
}
default:
......
......@@ -152,14 +152,14 @@ LOBESElementResponse::LOBESElementResponse(const std::string& name,
H5::H5File h5file;
if (!std::filesystem::exists(coeff_file_path)) {
throw std::runtime_error("LOBES coeffcients file: " +
throw std::runtime_error("LOBES coefficients file: " +
coeff_file_path.string() + " does not exists");
}
try {
h5file.openFile(coeff_file_path.c_str(), H5F_ACC_RDONLY);
} catch (const H5::FileIException& e) {
throw std::runtime_error("Could not open LOBES coeffcients file: " +
throw std::runtime_error("Could not open LOBES coefficients file: " +
coeff_file_path.string());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment