diff --git a/src/potential_file_reader.cpp b/src/potential_file_reader.cpp index 2730a3d109..bddfca9bce 100644 --- a/src/potential_file_reader.cpp +++ b/src/potential_file_reader.cpp @@ -62,7 +62,8 @@ PotentialFileReader::PotentialFileReader(LAMMPS *lmp, try { reader = open_potential(filename); if (!reader) { - error->one(FLERR, fmt::format("cannot open {} potential file {}", potential_name, filename)); + error->one(FLERR, fmt::format("cannot open {} potential file {}: {}", + potential_name, filename, utils::getsyserror())); } } catch (FileReaderException &e) { error->one(FLERR, e.what()); diff --git a/src/text_file_reader.cpp b/src/text_file_reader.cpp index af27bfb16d..7a6e914639 100644 --- a/src/text_file_reader.cpp +++ b/src/text_file_reader.cpp @@ -46,7 +46,8 @@ TextFileReader::TextFileReader(const std::string &filename, const std::string &f fp = fopen(filename.c_str(), "r"); if (fp == nullptr) { - throw FileReaderException(fmt::format("cannot open {} file {}", filetype, filename)); + throw FileReaderException(fmt::format("cannot open {} file {}: {}", + filetype, filename, utils::getsyserror())); } }