refactor getID

This commit is contained in:
Erik Frojdh
2019-03-19 16:27:07 +01:00
parent 38bf540c1a
commit 6759b2eeb8
9 changed files with 253 additions and 211 deletions

View File

@ -19,43 +19,56 @@ using sls::SocketError;
int main() {
//Catch exception
try {
throw RuntimeError("something went wrong");
} catch (RuntimeError &e) {
std::cout << "Caught RuntimeError with message : " << e.what() << '\n';
}
//Catch base class
try {
throw SharedMemoryError("Could not create shared memory");
} catch (RuntimeError &e) {
std::cout << "Caught: " << e.what() << '\n';
}
// const std::string hostname = "beb083";
// auto type = slsDetector::getTypeFromDetector(hostname);
// slsDetector d(type);
// d.setHostname(hostname);
// d.setReceiverHostname("mpc2408");
// std::cout << "hostname: " << d.getHostname() << '\n';
// std::cout << "port: " << d.getControlPort() << '\n';
// d.setOnline(true);
// d.setReceiverOnline(true);
// std::cout << "reciver version: " << std::hex << d.getReceiverVersion() << '\n';
// // std::cout << "version: " << d.getId(slsDetectorDefs::CLIENT_RECEIVER_API_VERSION) << '\n';
// d.freeSharedMemory();
// //Catch exception
// try {
// throw RuntimeError("something went wrong");
// } catch (RuntimeError &e) {
// std::cout << "Caught RuntimeError with message : " << e.what() << '\n';
// }
//Catch base class after looking for something else
try {
throw SharedMemoryError("Could not create shared memory");
} catch (SocketError &e) {
// //Catch base class
// try {
// throw SharedMemoryError("Could not create shared memory");
// } catch (RuntimeError &e) {
// std::cout << "Caught: " << e.what() << '\n';
// }
std::cout << "Caught Socket error: " << e.what() << '\n';
// //Catch base class after looking for something else
// try {
// throw SharedMemoryError("Could not create shared memory");
// } catch (SocketError &e) {
} catch (RuntimeError &e) {
std::cout << "Caught base class: " << e.what() << '\n';
}
// std::cout << "Caught Socket error: " << e.what() << '\n';
//Catch any after looking for something else
try {
throw SharedMemoryError("Could not create shared memory");
} catch (SocketError &e) {
// } catch (RuntimeError &e) {
// std::cout << "Caught base class: " << e.what() << '\n';
// }
std::cout << "Caught Socket error: " << e.what() << '\n';
// //Catch any after looking for something else
// try {
// throw SharedMemoryError("Could not create shared memory");
// } catch (SocketError &e) {
} catch (...) {
std::cout << "Caught Something else probably should have let me crash\n";
}
// std::cout << "Caught Socket error: " << e.what() << '\n';
// } catch (...) {
// std::cout << "Caught Something else probably should have let me crash\n";
// }
throw RuntimeError("This one we missed");
// throw RuntimeError("This one we missed");
return 0;
}