[vtk-developers] Exceptions

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Mon Mar 22 18:34:38 EST 2004


> > (Bad) There is a tendency to believe that throwing an exception makes
> > everything OK. Exception based error handling seems to frequently lack
> > appropriate try / catches.
>
> Exceptions are NOT a replacement for traditional error handling.
> Exceptions are meant to replace abort() calls or error handling in
> really severe cases.

Absolutely. There are two levels at which we could/should consider
exceptions in vtk

1) Put some try catch blocks around critical parts of filters. In particular
around the execute/update methods called from within vtkProcessObject (or
successor). And around places where memory allocation can cause trouble on
failure.

2) Start adding throw calls of our own, with stuff like
vtk::IllegalArgumentException vtk::MemoryAllocationException

I would advocate 1), but I'd stay short of 2) (at least initially).

JB




More information about the vtk-developers mailing list