Skip to content

Commit 5331a71

Browse files
committed
[config] Improve error reporting on config URI parsing
1 parent 0ab4226 commit 5331a71

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/CardConfigurator.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ CardConfigurator::CardConfigurator(Parameters::CardIdType cardId, std::string co
3939
}
4040
try {
4141
parseConfigUri(cardType, configUri, parameters);
42-
} catch (...) {
43-
throw;
42+
} catch (const std::runtime_error& e) {
43+
BOOST_THROW_EXCEPTION(e);
44+
} catch (const Exception& e) {
45+
BOOST_THROW_EXCEPTION(e);
4446
}
4547

4648
auto bar2 = ChannelFactory().getBar(parameters);
@@ -267,8 +269,10 @@ void CardConfigurator::parseConfigUriCru(std::string configUri, Parameters& para
267269
parameters.setGbtMuxMap(gbtMuxMap);
268270
parameters.setFeeIdMap(feeIdMap);
269271

270-
} catch (...) {
271-
BOOST_THROW_EXCEPTION(ParseException() << ErrorInfo::ConfigParse(group));
272+
} catch (const std::runtime_error& e) {
273+
BOOST_THROW_EXCEPTION(e);
274+
} catch (const Exception& e) {
275+
BOOST_THROW_EXCEPTION(e);
272276
}
273277
}
274278

src/CommandLineUtilities/ProgramConfig.cxx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ class ProgramConfig : public Program
153153
try {
154154
FirmwareChecker().checkFirmwareCompatibility(params);
155155
CardConfigurator(card.pciAddress, mOptions.configUri, mOptions.forceConfig);
156+
} catch (const std::runtime_error& e) {
157+
Logger::get() << e.what() << LogErrorOps << endm;
156158
} catch (const Exception& e) {
157159
Logger::get() << boost::diagnostic_information(e) << LogErrorOps << endm;
158160
}
@@ -242,6 +244,9 @@ class ProgramConfig : public Program
242244
Logger::get() << "Configuring with command line arguments" << LogDebugOps << endm;
243245
try {
244246
CardConfigurator(params, mOptions.forceConfig);
247+
} catch (const std::runtime_error& e) {
248+
Logger::get() << e.what() << LogErrorOps << endm;
249+
throw;
245250
} catch (const Exception& e) {
246251
Logger::get() << e.what() << LogErrorOps << endm;
247252
throw;
@@ -250,7 +255,10 @@ class ProgramConfig : public Program
250255
Logger::get() << "Configuring with config uri" << LogDebugOps << endm;
251256
try {
252257
CardConfigurator(cardId, mOptions.configUri, mOptions.forceConfig);
253-
} catch (std::exception& e) {
258+
} catch (const std::runtime_error& e) {
259+
Logger::get() << e.what() << LogErrorOps << endm;
260+
throw;
261+
} catch (const Exception& e) {
254262
Logger::get() << e.what() << LogErrorOps << endm;
255263
throw;
256264
}

0 commit comments

Comments
 (0)