[vtkusers] vtkXMLImageDataReader invalid file: error codes, exceptions?
Nico Schlömer
nico.schloemer at gmail.com
Sun Mar 7 17:38:36 EST 2010
Hi,
I read my VTI files with
======================= *snip* =======================
vtkSmartPointer<vtkXMLImageDataReader> reader =
vtkSmartPointer<vtkXMLImageDataReader>::New();
reader->SetFileName ( fileName );
reader->Update();
======================= *snap* =======================
which works beautifully if the file exists. If it doesn't, the error message
======================= *snip* =======================
ERROR: In /var/tmp/paludis/sci-libs-vtk-5.4.2-r1/work/VTK/IO/vtkXMLReader.cxx,
line 219
vtkXMLImageDataReader (0x29fcba0): Error opening file
/home/nico/scratch/loca/test1/solution.vti
ERROR: In /var/tmp/paludis/sci-libs-vtk-5.4.2-r1/work/VTK/Filtering/vtkExecutive.cxx,
line 757
vtkStreamingDemandDrivenPipeline (0x29ecac0): Algorithm
vtkXMLImageDataReader(0x29fcba0) returned failure for request:
vtkInformation
[...]
======================= *snap* =======================
is returned to the screen; and the program just rolls on! Well, that's
not quite what I want.
I'd like to stop the execution if no file is found, but couldn't find
any now to actually get error codes from the Update() methods (which
is where there error is reported). The GetErrorCode() method would
always return 0 in either case, and apparently VTK doesn't throw an
exception here either.
Any hints on how to tell in the code if Update() went wrong?
Cheers,
Nico
More information about the vtkusers
mailing list