Skip to content
Snippets Groups Projects
Commit 6de2672d authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

DeviceModule: print exception messages to stderr

This greatly helps debugging real setups, as the messages will usually end up in the server log.
Note: Ideally, a proper logging mechanism should be used instead, but this does not yet exist!
parent f892ac65
No related branches found
No related tags found
No related merge requests found
......@@ -303,6 +303,7 @@ namespace ChimeraTK {
catch(ChimeraTK::runtime_error& e) {
assert(deviceError.status != 0); // any error must already be reported...
if(firstAttempt) {
std::cerr << "Device " << deviceAliasOrURI << " reports error: " << e.what() << std::endl;
// set proper error message in very first attempt to open the device
deviceError.message = e.what();
deviceError.setCurrentVersionNumber({});
......@@ -312,6 +313,9 @@ namespace ChimeraTK {
continue; // should not be necessary because isFunctional() should return false. But no harm in leaving it in.
}
} while(!device.isFunctional());
if(!firstAttempt) {
std::cerr << "Device " << deviceAliasOrURI << " error cleared." << std::endl;
}
firstAttempt = false;
owner->testableModeLock("Initialise device");
......@@ -349,6 +353,7 @@ namespace ChimeraTK {
catch(ChimeraTK::runtime_error& e) {
assert(deviceError.status != 0); // any error must already be reported...
// update error message, since it might have been changed...
std::cerr << "Device " << deviceAliasOrURI << " reports error: " << e.what() << std::endl;
deviceError.message = e.what();
deviceError.setCurrentVersionNumber({});
deviceError.message.write();
......@@ -373,6 +378,7 @@ namespace ChimeraTK {
}
catch(ChimeraTK::runtime_error& e) {
// update error message, since it might have been changed...
std::cerr << "Device " << deviceAliasOrURI << " reports error: " << e.what() << std::endl;
deviceError.message = e.what();
deviceError.setCurrentVersionNumber({});
deviceError.message.write();
......@@ -435,6 +441,7 @@ namespace ChimeraTK {
errorLock.unlock(); // we must not hold the lock while waiting for the synchronousTransferCounter to go back to 0
// [ExceptionHandling Spec: C.3.3.14] report exception to the control system
std::cerr << "Device " << deviceAliasOrURI << " reports error: " << error << std::endl;
deviceError.status = 1;
deviceError.message = error;
deviceError.setCurrentVersionNumber({});
......
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