Skip to content

Commit 336d5ee

Browse files
committed
[roc] CLI tools should throw the errors they catch
1 parent 1419d58 commit 336d5ee

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/CommandLineUtilities/ProgramConfig.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class ProgramConfig : public Program
168168
FirmwareChecker().checkFirmwareCompatibility(cardId);
169169
} catch (const Exception& e) {
170170
Logger::get() << boost::diagnostic_information(e) << LogErrorOps << endm;
171-
return;
171+
throw(e);
172172
}
173173
}
174174

@@ -244,13 +244,15 @@ class ProgramConfig : public Program
244244
CardConfigurator(params, mOptions.forceConfig);
245245
} catch (const Exception& e) {
246246
Logger::get() << boost::diagnostic_information(e) << LogErrorOps << endm;
247+
throw(e);
247248
}
248249
} else {
249250
Logger::get() << "Configuring with config uri" << LogDebugOps << endm;
250251
try {
251252
CardConfigurator(cardId, mOptions.configUri, mOptions.forceConfig);
252253
} catch (std::runtime_error& e) {
253254
Logger::get() << "Error parsing the configuration..." << boost::diagnostic_information(e) << LogErrorOps << endm;
255+
throw(e);
254256
}
255257
}
256258
return;

src/CommandLineUtilities/ProgramListCards.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,9 @@ class ProgramListCards : public Program
8686
// Check if the firmware is tagged
8787
firmware = FirmwareChecker().resolveFirmwareTag(firmware);
8888
} catch (const Exception& e) {
89-
if (isVerbose()) {
90-
std::cout << "Error parsing card information through BAR\n"
91-
<< boost::diagnostic_information(e) << '\n';
92-
}
89+
std::cerr << "Error parsing card information through BAR\n"
90+
<< boost::diagnostic_information(e) << '\n';
91+
throw(e);
9392
}
9493

9594
// Pad the serial with 0s if necessary

src/CommandLineUtilities/ProgramSiuStatus.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ class ProgramSiuStatus : public Program
6969
try {
7070
siuStatus = crorc.siuStatus();
7171
} catch (const Exception& e) {
72-
std::cout << diagnostic_information(e) << std::endl;
73-
return;
72+
std::cerr << diagnostic_information(e) << std::endl;
73+
throw(e);
7474
}
7575

7676
std::stringstream ss;

0 commit comments

Comments
 (0)