Skip to content
Snippets Groups Projects
Commit 3341e461 authored by Jan Reher's avatar Jan Reher
Browse files

Cleaner error handling? Maybe?

parent 9e8fa623
No related branches found
No related tags found
2 merge requests!4Many proven updates being brought into stable branch.,!3Commented in the lines in apdUnitCreator.cpp that do the actual database
Pipeline #1603 failed with stages
in 1 second
......@@ -47,20 +47,24 @@ int main(int argc, char* argv[]) {
}
if (debug) cout << "Connection successful!" << endl;
int nFailed = 0;
for (auto newUnit = newUnits.begin(); newUnit < newUnits.end(); newUnit++) {
try {
proddb->createApdCapsule(newUnit->redSerial, newUnit->blueSerial);
std::string capsuleSerial = newUnit->blueSerial + "/" + newUnit->redSerial;
proddb->createApdUnit(capsuleSerial, newUnit->crystalSerial, newUnit->barCode);
}
catch (exception e) {
catch (std::exception e) {
nFailed++;
std::cerr << "An error occurred on APD paid with red APD " << newUnit->redSerial << " and blue APD " << newUnit->blueSerial << "!" << std::endl;
std::cerr << e.what();
std::cerr << e.what() << std::endl << std::endl;
continue;
}
}
cout << "Created " << newUnits.size() << " APD Capsules and assigned them to Units.";
cout << "Created " << newUnits.size() << " APD Capsules and assigned them to Units." << std::endl;
if (nFailed > 0)
cerr << "Data entry failed for " << nFailed << " entries!" << std::endl;
return (-newUnits.empty());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment