- std::string msg = "Shutting down host, but it's not empty:";
- for (auto const& actor : actor_list_)
- msg += "\n\t" + std::string(actor.get_name());
-
- EngineImpl::get_instance()->display_all_actor_status();
- xbt_die("%s", msg.c_str());
+ const char* msg = "Shutting down host, but it's not empty";
+ try {
+ std::string actors;
+ for (auto const& actor : actor_list_)
+ actors += "\n\t" + std::string(actor.get_name());
+
+ EngineImpl::get_instance()->display_all_actor_status();
+ xbt_die("%s:%s", msg, actors.c_str());
+ } catch (std::bad_alloc& ba) {
+ xbt_die("%s (cannot print actor list: %s)", msg, ba.what());
+ }