diff --git a/cpp/elementresponsefactory.cc b/cpp/elementresponsefactory.cc index 374bc825d3dd17447174ce69d56d4ddf4e7ecd14..ec576392f9dc9195c971af9409f0c85f9f6eca17 100644 --- a/cpp/elementresponsefactory.cc +++ b/cpp/elementresponsefactory.cc @@ -31,10 +31,15 @@ std::shared_ptr<const ElementResponse> ElementResponse::GetInstance( try { return LOBESElementResponse::GetInstance(name, options); } catch (const std::runtime_error& e) { - 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; + static bool first_time = true; + if (first_time) { + std::cout << "Creating LOBESElementResponse for station " << name + << " 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: diff --git a/cpp/lobes/lobeselementresponse.cc b/cpp/lobes/lobeselementresponse.cc index 94726135778bde477b0df91dcefb214e1f42e947..83468a04fab1014aaf486084bb28e55295460619 100644 --- a/cpp/lobes/lobeselementresponse.cc +++ b/cpp/lobes/lobeselementresponse.cc @@ -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()); }