Skip to content

Commit 34915de

Browse files
SuvarnaMeenakshistcheng
authored andcommitted
[portsyncd]: Add default catch block in portsyncd (#1033)
* Add default catch block in portsyncd * Updated error message with the right spelling * Update try block to throw exception of type runtime_error * Remove additional paranthesis in throw statement
1 parent dc81a21 commit 34915de

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

portsyncd/portsyncd.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,15 @@ int main(int argc, char **argv)
163163
}
164164
catch (const std::exception& e)
165165
{
166-
cerr << "Exception \"" << e.what() << "\" had been thrown in deamon" << endl;
166+
cerr << "Exception \"" << e.what() << "\" was thrown in daemon" << endl;
167167
return EXIT_FAILURE;
168168
}
169+
catch (...)
170+
{
171+
cerr << "Exception was thrown in daemon" << endl;
172+
return EXIT_FAILURE;
173+
}
174+
169175

170176
return 1;
171177
}
@@ -224,7 +230,7 @@ void handlePortConfigFile(ProducerStateTable &p, string file, bool warm)
224230
if (!infile.is_open())
225231
{
226232
usage();
227-
throw "Port configuration file not found!";
233+
throw runtime_error("Port configuration file not found!");
228234
}
229235

230236
list<string> header = {"name", "lanes", "alias", "speed", "autoneg", "fec"};

0 commit comments

Comments
 (0)