How can I throw a custom error if the filter snap lets through no records?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2023 08:57 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2023 11:53 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2023 01:14 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2023 01:17 AM
This is how the validation looks like when there are no records going through.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2023 01:26 AM
And if you enable null-safe acces in the filter snap?