[Insight-developers] [ITK Community] ObjectFactoryBase throwing uncaught exceptions

Matt McCormick matt.mccormick at kitware.com
Tue Jan 14 17:32:53 EST 2014


Hi Brian,

Since the factories can be registered at runtime, it seems reasonable
that an application may want to recover from these failures cleanly.

For example, Slicer seems to look for these exceptions [1].

Thanks,
Matt

[1] https://github.com/Slicer/Slicer/blob/master/Libs/vtkITK/vtkITKArchetypeImageSeriesReader.cxx#L162

On Tue, Jan 14, 2014 at 4:24 PM, Brian Helba <brian.helba at kitware.com> wrote:
> Hello all,
>
> Reviewing some of Coverity's results, I've noticed that there are 283
> "Uncaught exception" defects, all triggered by the same code in
> Modules/Core/Common/src/itkObjectFactoryBase.cxx.
>
> Much of the library and factory loading code in ObjectFactoryBase uses the
> itkGenericExceptionMacro to throw exceptions in cases of unexpected
> conditions or errors. Obviously any user that doesn't enclose their entire
> program in a try block could theoretically have a program crash due to an
> uncaught exception.
>
> The question is: is there a use case where a user would want to catch and
> respond to these sort of library and factory load errors and attempt to
> recover from them? If not, then the exceptions could and perhaps should be
> replaced with a simple abort.
>
> Looking forward to your feedback,
> Brian
>
> --
> Brian Helba
> Medical Imaging
> Kitware, Inc.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>


More information about the Insight-developers mailing list