Explorar o código

Improved error message when registering a service.

Sascha Zelzer %!s(int64=14) %!d(string=hai) anos
pai
achega
1d5b716109
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      Libs/PluginFramework/ctkServices.cpp

+ 3 - 2
Libs/PluginFramework/ctkServices.cpp

@@ -121,8 +121,9 @@ ctkServiceRegistration* ctkServices::registerService(ctkPluginPrivate* plugin,
     {
       if (!checkServiceClass(service, cls))
       {
-        throw std::invalid_argument
-            (std::string("Service object is not an instance of ") + cls.toStdString());
+        QString msg = QString("Service class %1 is not an instance of %2. Maybe you forgot the Q_INTERFACES macro in the service class.")
+            .arg(service->metaObject()->className()).arg(cls);
+        throw std::invalid_argument(msg.toStdString());
       }
     }
   }