Try-Catch handling does not use default branch in case of failed main branch

Hi,
currently I don’t understand, why the Try-Catch handling in some cases (see attached examples) doesn’t work as I expected: take the (available) default branch if the main branch is failing.
But as you can see, in this cases the Catch node simply shows not any reaction (even not any error notification), although the default branch has alternative data.
Could somebody help me to understand?
Maybe I haven’t understood the whole Try-Catch-handling logic correctly.
Thank you in advance!

P.S.: I am working with KNIME 4.5.2

not_working_try_catch_examples.knwf (40.5 KB)

If I have a look at your first example it seems like a wrong node configuration not a real error that’s why try catch does not work
br

4 Likes

@bkaya like @Daniel_Weikert has said: the node first will have to work and the error might occur during runtime.

Then: you have to check the wiring of the block.

image

I think the Try Block with the data has to use the same data or it has to be connected thru an Active Branch Inverter – KNIME Hub - but you might have to test that.

3 Likes

Hi @bkaya and welcome to the Knime Community.

What both @Daniel_Weikert and @mlauber71 have said is correct.

Basically, the Try/Catch will catch any errors at run time, meaning that your workflow should be in a state where it can run in the first place.

Based on what we see from your screenshot, these Row Filter nodes at the top end (Node 46, 78 and 82) are not properly configured (they’re all in the “red” state). So at that point, you are not even reaching the Catch Errors node.

Here’s an example of how the state of each workflow should look like:
image

My GET Request is properly configured and is ready to run. It will fail when I run it, because I will pass an invalid url for it to process.

My url is literally “invalid url”:
image

And my default value to use in case of error is this:
image

So, when I run the demo, I get this as expected:
image

You can see that the Node 3 is not in the red state, but rather in an executed state, but a failed execution one.

If I look at the final result from the Catch Errors, I see this:
image

And I am able to see what the error messages that were captured:

And if I change the url to a valid one:
image

Everything works fine:
image

And the results are whatever come from the GET Request node:

And there aren’t any error messages:
image

4 Likes

Great example @bruno29a with step by step explanations. Very helpful as always.
br

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.