Are there a correct way to possiblly catch the vtk error after a reader or filter update? My EMPHASIS is why some vtkErrorEvent could be caught while some can not be caught, by the following means (1) method?
At this point, I checked and searched through the blocks. some hints found are here:
(1) use observer, add callback function
(2) use vtkOutputWindow to redirect error message to a file
here followed is my testing file (intentionally file version error):
# vtk DataFile Version 5.1
untitled, Created by Gmsh 4.10.5
ASCII
DATASET POLYDATA
POINTS 10 double
0 0 0
0 1 0
1 0 0
1 1 0
2 0 0
2 1 0
3 0 0
3 1 0
4 0 0
4 1 0
TRIANGLE_STRIPS 1 11
10 0 1 2 3 4 5 6 7 8 9
testing code:
@calldata_type(‘string0’)
def vtkErrorEventHandler(object, event, callData):
print(f"caught in vtkErrorEventHandler")
print(f"callData:\n {callData}")
reader = vtkDataSetReader()
reader.SetFileName(‘versionerror.vtk’)
reader.AddObserver(“ErrorEvent”, vtkErrorEventHandler)
reader.Update()
the poping vtk error message is :
2023-08-09 14:53:53.618 ( 0.654s) [ ] vtkDataReader.cxx:3113 ERR| vtkPolyDataReader (000002988F19D6A0): Error reading cell array offset header.
2023-08-09 14:53:53.670 ( 0.706s) [ ] vtkPolyDataReader.cxx:201 ERR| vtkPolyDataReader (000002988F19D6A0): Error reading triangle_strips.
this ErrorEvent can not be caught by vtkErrorEventHandler.
thanks alot