[Ctk-developers] ctkPlugins::install hides the original cause of ctkPluginExceptions

Sascha Zelzer s.zelzer at dkfz-heidelberg.de
Tue Dec 4 13:32:29 EST 2012


Hi Miklos,

thanks for reporting this. In my opinion, code in 
ctkPluginStorageSQL.cpp shouldn't throw ctkPluginException objects but 
rather ctkRuntimeException or similar. This code misuses 
ctkPluginException in a semantic sense.

But you are right that the error messages from wrapped exceptions could 
be suppressed in the console output if not handled properly. For MITK, 
the following commit fixed this:

https://github.com/MITK/MITK/commit/298de77d3de67c228e51e6c4b9959902b3840372

Thanks,
Sascha

On 12/04/2012 06:09 PM, Miklos Espak wrote:
> Hi,
>
> CTK failed to install one of our MITK plugins. The error turned to be
> in our plugin, but I found a little mistake in the CTK code while
> debugging, that made it a bit difficult to find the error in the
> plugin.
>
> In ctkPluginStorageSQL.cpp:436 a ctkPluginException is thrown when a
> plugin could not be loaded.
>
> This is fine, but in ctkPlugins.cpp:125-139 it is caught as
> ctkException, and re-wrapped to another ctkPluginException.
>
> Because of this, the original error does not appear in the log
> (BlueBerry.consoleLog), what makes it a bit troublesome to find out
> what is wrong with the plugin.
>
> Inserting these lines at line 125 has solved the problem for me:
>
>      catch (const ctkPluginException& e)
>      {
>        if (!pa.isNull())
>        {
>          pa->purge();
>        }
>        throw e;
>      }
>
>
> Cheers,
> Miklos
> _______________________________________________
> Ctk-developers mailing list
> Ctk-developers at commontk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers




More information about the Ctk-developers mailing list