[vtkusers] VTK error handling

Jothy jothybasu at gmail.com
Thu Aug 26 07:28:11 EDT 2010


Why don't you use a if statement to find out whether the file really exists
are not?

The try to read it.

Jothy

On Thu, Aug 26, 2010 at 12:24 PM, John Fraser <John.Fraser at icr.ac.uk> wrote:

>  Hello,
>
> I was wondering if anyone can give some advice on VTK and error /
> exception handling.  For example, if I have something like this:
>
> vtkSmartPointer<vtkImageReader> imageReader =
> vtkSmartPointer<vtkImageReader>::New();
> imageReader->SetFileName("NoSuchFile.bin");
> ... etc
> imageReader->Update();
>
> NoSuchFile.bin does not exist.  Now when Update is executed an error window
> pops up (which I can remove by setting a vtkFileOutputWindow instead), but
> how can I checked programmatically that the Update did not succeed due to
> the file not being found or out of memory, etc?  I have tried, try/catch and
> GetErrorCode (which always seems to return 0?) and looked through the books
> but there is no mention of error handling.
>
> John
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100826/04773f2d/attachment.htm>


More information about the vtkusers mailing list