[vtk-developers] RFC: PATCH for exception handling in vtkWrapPython.c

Charl P. Botha c.p.botha at ewi.tudelft.nl
Sat Mar 13 09:20:05 EST 2004


Ken Martin wrote:
> VTK doesn't throw exceptions so I'm not sure I understand the logic of
> wrapping all the VTK calls (Python wrapped) with Try Catch. I'm not saying
> I'm against this I just want to understand the alternatives. For example, as
> I understand it the problem here is that the invocation from Python is to
> VTK, which then invokes ITK through the VTK/ITK interface classes. ITK
> throws and nothing catches. Why not modify the ITK->VTK class to try/catch
> around its invocations of ITK and then display the exception as a vtkError?
> This has the advantage of addressing the problem for all wrapped languages
> and C++ as well without much bloat. What are the disadvantages of that
> approach?

I've now committed this.  Here is the change log message:

-----
revision 1.42
date: 2004/03/13 14:16:11;  author: cpbotha;  state: Exp;  lines: +89 -20

ENH: vtkImageImport.cxx now supports exception handling.  If a callback 
throws an exception, it's handled by calling vtkErrorMacro() with the 
error message that is passed with the exception object.  This 
functionality is especially crucial when ITK and VTK pipelines are 
connected: ITK throws an exception when an error occurs.  If VTK doesn't 
catch this, the application is unceremoniously dumped to the command-line.

Thanks to Ken Martin for the idea of implementing this handling directly
in vtkImageImport.
----

-- 
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/




More information about the vtk-developers mailing list