Add missing try-catch

This commit is contained in:
Richard Berger
2020-06-02 18:37:04 -04:00
parent 18bb4bfdc2
commit 185eeaea8b
3 changed files with 41 additions and 32 deletions

View File

@ -506,9 +506,9 @@ void AngleTable::param_extract(Table *tb, char *line)
tb->fpflag = 0; tb->fpflag = 0;
tb->theta0 = MY_PI; tb->theta0 = MY_PI;
try {
ValueTokenizer values(line); ValueTokenizer values(line);
try {
while (values.has_next()) { while (values.has_next()) {
std::string word = values.next_string(); std::string word = values.next_string();

View File

@ -476,7 +476,9 @@ void BondTable::param_extract(Table *tb, char *line)
tb->fpflag = 0; tb->fpflag = 0;
tb->r0 = 0.0; tb->r0 = 0.0;
try {
ValueTokenizer values(line); ValueTokenizer values(line);
while (values.has_next()) { while (values.has_next()) {
std::string word = values.next_string(); std::string word = values.next_string();
@ -492,6 +494,9 @@ void BondTable::param_extract(Table *tb, char *line)
error->one(FLERR,"Invalid keyword in bond table parameters"); error->one(FLERR,"Invalid keyword in bond table parameters");
} }
} }
} catch(TokenizerException & e) {
error->one(FLERR, e.what());
}
if (tb->ninput == 0) error->one(FLERR,"Bond table parameters did not set N"); if (tb->ninput == 0) error->one(FLERR,"Bond table parameters did not set N");
} }

View File

@ -557,6 +557,7 @@ void PairTable::param_extract(Table *tb, char *line)
tb->rflag = NONE; tb->rflag = NONE;
tb->fpflag = 0; tb->fpflag = 0;
try {
ValueTokenizer values(line); ValueTokenizer values(line);
while (values.has_next()) { while (values.has_next()) {
@ -577,6 +578,9 @@ void PairTable::param_extract(Table *tb, char *line)
error->one(FLERR,fmt::format("Invalid keyword {} in pair table parameters", word).c_str()); error->one(FLERR,fmt::format("Invalid keyword {} in pair table parameters", word).c_str());
} }
} }
} catch (TokenizerException & e) {
error->one(FLERR, e.what());
}
if (tb->ninput == 0) error->one(FLERR,"Pair table parameters did not set N"); if (tb->ninput == 0) error->one(FLERR,"Pair table parameters did not set N");
} }