micro-manager / mmCoreAndDevices

Micro-Manager's device control layer, written in C++
41 stars 109 forks source link

`waitForConfig()` is swallowing exceptions #400

Open hinderling opened 1 year ago

hinderling commented 1 year ago

As discussed in micro-manager/pymmcore#90 there seems to be unexpected behaviour in waitForConfig(), where errors are logged but ignored:

void CMMCore::waitForConfig(const char* group, const char* configName) throw (CMMError)
{
   CheckConfigGroupName(group);
   CheckConfigPresetName(configName);

   Configuration cfg = getConfigData(group, configName);
   try {
      for(size_t i=0; i<cfg.size(); i++)
         waitForDevice(cfg.getSetting(i).getDeviceLabel().c_str());
   } catch (CMMError& err) {
      // trap MM exceptions and keep quiet - this is not a good time to blow up
      logError("waitForConfig", err.getMsg().c_str());
   }
}

For comparison, in waitForSystem() errors like e.g. a device timeout error are propagated from waitForDevice()->waitForDeviceType()->waitForSystem().

As by @marktsuchida, it's been this way since 2007, so changing this would probably break existing scripts.

marktsuchida commented 1 year ago

Thanks for creating the issue. We might be able to slowly migrate this to throwing using the new "feature" facility (#394/#399).