cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How can I throw a custom error if the filter snap lets through no records?

vgautam64
New Contributor III

My pipe has a filter snap. I want to design it in a way that it throws a custom error when the filter snap does not let through any records.

5 REPLIES 5

JensDeveloper
Contributor II

Hi @vgautam64
I think you can only throw a custom error when the filter snap fails. Otherwise I would recommend using a mapper snap after the filter snap to check if the input is empty or not and fill it with default when empty and then use a router snap to route default to second output and create a custom error message.
Example pipeline below.
custom_error_filter_2023_04_04.slp (6.3 KB)
Let me know if this helps

Ok, so since it is a โ€˜double notโ€™ condition, we need an AND operator (&&) to not pass the record if its null or empty. But there is another issue. When there is no data flowing to the output of the filter snap, the following snap (in this case the Mapper) doesnโ€™t have any records to process. I want to throw an error message when this happens.

This is how the validation looks like when there are no records going through.

image

And if you enable null-safe acces in the filter snap?