# vtkPolyDataAlgorithm: how does Update() deal with return value of RequestData()?

**URL:** https://discourse.vtk.org/t/vtkpolydataalgorithm-how-does-update-deal-with-return-value-of-requestdata/4070
**Category:** Support
**Created:** [August 25, 2020, 7:06pm UTC](https://discourse.vtk.org/t/vtkpolydataalgorithm-how-does-update-deal-with-return-value-of-requestdata/4070 "2020-08-25T19:06:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Tomasso](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tomasso/32/5786_2.png) [@Tomasso](https://discourse.vtk.org/u/Tomasso)
#### Post date: [August 25, 2020, 7:06pm UTC](https://discourse.vtk.org/t/vtkpolydataalgorithm-how-does-update-deal-with-return-value-of-requestdata/4070/1 "2020-08-25T19:06:36Z")

</div>

void vtkPolyDataAlgorithm::Update() calls virtual int vtkPolyDataAlgorithm::RequestData(). MyAlgorithm is a subclass of vtkPolyDataAlgorithm, and overrides virtual int vtkPolyDataAlgorithm::RequestData(). But [the Doxygen](https://vtk.org/doc/nightly/html/classvtkPolyDataAlgorithm.html) doesn’t describe what int value RequestData() should return in case of error. Based on some other example, I assumed a return value of ‘1’ means success, and return value of ‘0’ means error. But Update() returns void. So how can an application that calls Update() (which calls RequestData()), know that an error value was returned by RequestData()?  
Thanks!

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [August 26, 2020, 9:01pm UTC](https://discourse.vtk.org/t/vtkpolydataalgorithm-how-does-update-deal-with-return-value-of-requestdata/4070/2 "2020-08-26T21:01:11Z")

</div>

Hi, Tom,

`vtkAlgorithm` has a method called `GetErrorCode()`. Maybe you can try this one to test whether there was an error during the execution of the algorithm. I never implemented one myself though. `Update()` is just like saying “Algorithm, the data have changed, so you need to redo your computation.” Error checking during said computations must be done separately.

You can also attach an observer to any algorithm object with `vtkAlgorithm::SetProgressObserver()` to possibly monitor errors during the execution of the algorithm.

regards,

Paulo
