expand exception message to include cause of file open failure
This commit is contained in:
@ -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());
|
||||
|
||||
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user