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( ...@@ -31,10 +31,15 @@ std::shared_ptr<const ElementResponse> ElementResponse::GetInstance(
try { try {
return LOBESElementResponse::GetInstance(name, options); return LOBESElementResponse::GetInstance(name, options);
} catch (const std::runtime_error& e) { } catch (const std::runtime_error& e) {
static bool first_time = true;
if (first_time) {
std::cout << "Creating LOBESElementResponse for station " << name std::cout << "Creating LOBESElementResponse for station " << name
<< " failed because: " << std::endl; << " failed because: \n"
std::cout << e.what() << std::endl; << e.what() << '\n'
std::cout << "Switching to HamakerElementResponse instead" << std::endl; << "Switching to HamakerElementResponse instead. Further "
"warnings of this type will be suppressed.\n";
first_time = false;
}
return std::make_shared<HamakerElementResponse>(name); return std::make_shared<HamakerElementResponse>(name);
} }
default: default:
......
...@@ -152,14 +152,14 @@ LOBESElementResponse::LOBESElementResponse(const std::string& name, ...@@ -152,14 +152,14 @@ LOBESElementResponse::LOBESElementResponse(const std::string& name,
H5::H5File h5file; H5::H5File h5file;
if (!std::filesystem::exists(coeff_file_path)) { 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"); coeff_file_path.string() + " does not exists");
} }
try { try {
h5file.openFile(coeff_file_path.c_str(), H5F_ACC_RDONLY); h5file.openFile(coeff_file_path.c_str(), H5F_ACC_RDONLY);
} catch (const H5::FileIException& e) { } 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()); 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