Skip to content

Commit

Permalink
MultiFabRegister: throw in get
Browse files Browse the repository at this point in the history
Throw a runtime exception instead of returning a `nullptr` if a
field is requested via the getter.
  • Loading branch information
ax3l committed Oct 2, 2024
1 parent 025f70e commit cb253dd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Source/ablastr/fields/MultiFabRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ namespace ablastr::fields
)
{
if (m_mf_register.count(internal_name) == 0) {
// FIXME: temporary, throw a std::runtime_error
// throw std::runtime_error("MultiFabRegister::get name does not exist in register: " + key);
throw std::runtime_error("MultiFabRegister::get name does not exist in register: " + key);
return nullptr;
}
amrex::MultiFab & mf = m_mf_register.at(internal_name).m_mf;
Expand All @@ -365,8 +364,7 @@ namespace ablastr::fields
) const
{
if (m_mf_register.count(internal_name) == 0) {
// FIXME: temporary, throw a std::runtime_error
// throw std::runtime_error("MultiFabRegister::get name does not exist in register: " + internal_name);
throw std::runtime_error("MultiFabRegister::get name does not exist in register: " + internal_name);
return nullptr;
}
amrex::MultiFab const & mf = m_mf_register.at(internal_name).m_mf;
Expand Down

0 comments on commit cb253dd

Please sign in to comment.