# Error handling

**URL:** https://discourse.vtk.org/t/error-handling/603
**Category:** Development
**Created:** [March 25, 2019, 4:36pm UTC](https://discourse.vtk.org/t/error-handling/603 "2019-03-25T16:36:11Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![michal.wozniak](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/848f3c/32.png) [@michal.wozniak](https://discourse.vtk.org/u/michal.wozniak)
#### Post date: [March 25, 2019, 4:36pm UTC](https://discourse.vtk.org/t/error-handling/603/1 "2019-03-25T16:36:11Z")

</div>

Hi,

What is the best way to handle VTK errors while chaining multiple VTK filters?

- Use vtkErrorCode to add specific error code and then do

> const bool result = filter-\>GetErrorCode() == _vtkErrorCode_ ::NoError; //continue or handle error

I only saw VTK readers/writers using them, but I’m wondering if I could use SetErrorCode in my own custom filters.

- Use [Error Observer](https://vtk.org/Wiki/VTK/Examples/Cxx/Utilities/ObserveError)

thanks
