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

Charl P. Botha c.p.botha at ewi.tudelft.nl
Mon Mar 1 17:55:58 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?

That's a very good idea and I think it would solve the problem as well. 
  Your suggestion comes down to modifying vtkImageImport with try/catch 
blocks around all its callback invocations.  It's definitely far less 
effort than my previous attempt.

I'm going to think about this some more (it's bed-time around here). 
Any other comments/ideas/opinions are also appreciated.

Thank you Ken,
Charl

ps. what's the larger vision with regards to exception use in VTK?  If 
VTK is going to embrace them at some stage, adapting the wrapping system 
now is not a bad idea.

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




More information about the vtk-developers mailing list