File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,18 @@ namespace ioh::common
126
126
void include (const std::string &name, const int id, Creator creator)
127
127
{
128
128
const auto already_defined = name_map.find (name) != std::end (name_map);
129
- assert (!already_defined && name.c_str ());
129
+
130
+ // Enhanced assertion message
131
+ if (already_defined) {
132
+ std::string error_message = " Error: The name '" + name + " ' has already been defined in the factory." ;
133
+
134
+ // Output the error message to both std::cerr and std::cout
135
+ std::cerr << error_message << std::endl;
136
+ std::cout << error_message << std::endl;
137
+
138
+ assert (false );
139
+ }
140
+
130
141
name_map[name] = std::move (creator);
131
142
if (!already_defined)
132
143
id_map[check_or_get_next_available (id)] = name;
You can’t perform that action at this time.
0 commit comments