mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Placing id read in try-catch.
This commit is contained in:
parent
163304773e
commit
f6b251145f
1 changed files with 9 additions and 1 deletions
|
|
@ -113,7 +113,15 @@ void legacy_assign_material(const std::string& mat_string,
|
|||
|
||||
// if no material was set using a name, assign by id
|
||||
if (!mat_found_by_name) {
|
||||
c->material_.emplace_back(std::stoi(mat_string));
|
||||
try {
|
||||
auto id = std::stoi(mat_string);
|
||||
c->material_.emplace_back(id);
|
||||
} catch (...) {
|
||||
std::stringstream err_msg;
|
||||
err_msg << "No material " << mat_string
|
||||
<< " found for volume (cell) " << c->id_;
|
||||
fatal_error(err_msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (settings::verbosity >= 10) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue