Skip to content

Commit

Permalink
Turning assert into real exception
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed May 15, 2017
1 parent 1d2b747 commit da5d22c
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/runtime/actions/detail/action_factory.cpp
Expand Up @@ -129,20 +129,34 @@ namespace hpx { namespace actions { namespace detail

if (id >= this_.cache_.size())
{
std::string msg(
"Unknown type desciptor " + std::to_string(id));
std::string msg("Unknown type descriptor " + std::to_string(id));
#if defined(HPX_DEBUG)
if (name != nullptr)
{
msg += ", for typename " + *name + "\n";
msg += this_.collect_registered_typenames();
msg += ", for typename " + *name;
}
msg += this_.collect_registered_typenames();
#endif
HPX_THROW_EXCEPTION(serialization_error,
"action_registry::create", msg);
return nullptr;
}

ctor_t ctor = this_.cache_[id];
HPX_ASSERT(ctor != nullptr);
if (ctor != nullptr)
{
std::string msg("Unknown type descriptor " + std::to_string(id));
#if defined(HPX_DEBUG)
if (name != nullptr)
{
msg += ", for typename " + *name;
}
msg += this_.collect_registered_typenames();
#endif
HPX_THROW_EXCEPTION(serialization_error,
"action_registry::create", msg);
return nullptr;
}
return ctor(with_continuation);
}

Expand Down

0 comments on commit da5d22c

Please sign in to comment.