- xbt_assert(not xbt_lib_get_or_null(storage_lib, storage->id, ROUTING_STORAGE_LEVEL),
- "Refusing to add a second storage named \"%s\"", storage->id);
-
- xbt_assert(storage_types.find(storage->type_id) != storage_types.end(), "No storage type '%s'", storage->type_id);
- storage_type_t stype = storage_types.at(storage->type_id);
+ xbt_assert(std::find(known_storages.begin(), known_storages.end(), storage->id) == known_storages.end(),
+ "Refusing to add a second storage named \"%s\"", storage->id.c_str());
+
+ storage_type_t stype;
+ try {
+ stype = storage_types.at(storage->type_id);
+ } catch (std::out_of_range& unfound) {
+ xbt_die("No storage type '%s'", storage->type_id.c_str());
+ }