-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mmc.getNumberOfStates(const char& stateDeviceLabel) with an unknown device throws an uncaught exception #165
Comments
Code looks as follows:
It is easy to test whether or not the device exists, but unclear what to return if it doesn't (since the function does not throw). It also looks like many (all?) other functions taking a device label have the same issue. It makes for a bit of unpleasant scripting if a single typo results in the application disappearing;). |
Ugh. Of course we could add (In principle we could throw an unchecked exception (subclass of For the short-term fix of I did a quick pass over PropertyBlock getStateLabelData(const char* stateDeviceLabel, const char* stateLabel);
PropertyBlock getData(const char* stateDeviceLabel);
void setFocusDirection(const char* stageLabel, int sign);
bool supportsDeviceDetection(char* deviceLabel);
MM::DeviceDetectionStatus detectDevice(char* deviceLabel);
Would be great if you could also look over the functions to see if I missed any. I'm happy to make these changes if you like. For the proper fix, there is also the possibility of deprecating the current functions and adding new ones. For example, MMCORE_DEPRECATED(long getNumberOfStates(const char* stateDeviceLabel)); // Returns -1 on error
long getStateDeviceNumberOfStates(const char *stateDeviceLabel) throw (CMMError); // New function |
Not sure if this is related, but:: Your list looks quite complete. Most everything else seems to throw (CMMError). Will be wonderful if you can make the changes you propose. Thanks! |
Will do. Looking at the code, |
Crashes should no longer occur (#173), but I'm leaving this open because we should consider adding functions with better error reporting (see the |
which in turn makes the application disappear.
Tested with the demo configuration. In the script panel type:
mmc.getNumberOfStates("Dichroic");
<10>
mmc.getNumberOfStates("D");
resulting in uncaught exception.
The text was updated successfully, but these errors were encountered: