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

Added exception handling to process further APDs if one step fails.

parent e9d93e9a
No related branches found
No related tags found
Loading
Pipeline #1601 failed with stages
in 2 seconds
......@@ -48,9 +48,16 @@ int main(int argc, char* argv[]) {
if (debug) cout << "Connection successful!" << endl;
for (auto newUnit = newUnits.begin(); newUnit < newUnits.end(); newUnit++) {
proddb->createApdCapsule(newUnit->redSerial, newUnit->blueSerial);
std::string capsuleSerial = newUnit->blueSerial + "/" + newUnit->redSerial;
proddb->createApdUnit(capsuleSerial, newUnit->crystalSerial, newUnit->barCode);
try {
proddb->createApdCapsule(newUnit->redSerial, newUnit->blueSerial);
std::string capsuleSerial = newUnit->blueSerial + "/" + newUnit->redSerial;
proddb->createApdUnit(capsuleSerial, newUnit->crystalSerial, newUnit->barCode);
}
catch (exception e) {
std::cerr << "An error occurred on APD paid with red APD " << newUnit->redSerial << " and blue APD " << newUnit->blueSerial << "!" << std::endl;
std::cerr << e.what();
continue;
}
}
cout << "Created " << newUnits.size() << " APD Capsules and assigned them to Units.";
......
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