Catch Errors (Data Ports) node - variable _error_reason fades away

I’m using the “Catch Errors (Data Ports)” node and need the error message stored in the _error_reason variable. For this I use the “Variable to Table Row” node including the variable “FailingNodeMessage”, which was available when I’ve set up the node. But when I execute the workflow I get the message that this variable does not exist.

“WARN Catch Errors (Data Ports) 2:41 Errors overwriting node settings with flow variables: Unknown variable” _error_reason “”

Has anyone experienced this situation?

Here is the workflow:

try

Note that “_error_reason” is available to be selected:

But after this option is selected, the variable fades out:

Sem%20t%C3%ADtulo

Hi there!

Welcome to the KNIME community!

Haven’t seen this one before. Which KNIME version are you using? Are these _error_stacktrace, _error_reason and _error_node variables created by yourself and if yes in which node?

If you want the error message (value from flow variable FailingNodeMessage) to be stored in a flow variable called _error_reason you can create flow variable inside Catch Errors node like this:

On Flow Variables tab add _error_reason to the text field on the right of appropriate configuration setting.
TryCatch3
FailingNodeMessage flow variable is changed to test just to verify we configured a right option on Flow Variables tab as all are none by default.
TryCatch1
Upon node execution _error_reason flow variable is created and has the same value (test) as FailingNodeMessage flow variable.

If you are trying something else just write it down and we’ll try to help :slight_smile:

Br,
Ivan

1 Like

Hi Ivan,

Thanks a lot for your answer.

I’m using KNIME 3.7.1. The variables _error_stacktrace, _error_reason and error_node were not created by myself but they appear after the first workflow execution, when the database exception ORA-00001 was raised and got by Catch Errors node. So, after the first execution, I opened the Catch Errors (Data Ports) node and the variables were available for selection. I’ve selected _error_reason variable and clicked on OK button. Immediately the message ‘WARN Catch Errors (Data Ports) 2:41 Errors overwriting node settings with flow variables: Unknown variable “_error_reason”’ appears. I’m not sure if the variables _error_stacktrace, _error_reason and error_node were available because I activated the option Error Handling on “Database Writer” node.

I’ll follow the instructions you suggested and I will post the results.

One time more: thank you.

Best,

Renê

1 Like

Hi Ivan,

I’ve applied the solution of create a variable named _error_message, as you suggested before. Now there is no error, but this variable do not catch the reason for error raised by Database Writer node, because _error_message was created by myself.

It appears the variables _error_stacktrace, _error_reason, _error_node and _error_caught are available only after a iteration that raised an error (see the image below).

But after node reset, the _error variables are not accessible…

I don’t know how to get the exception that Database Writer raises, as the value returned in the _error_reason variable is the default value of FailingNodeMessage option of Cath Errors (Data Ports) node.

default_value

Do you have any suggestion to solve this issue ?

Thank you.

Renê

Hi Rene!

_error_reason and others are indeed created and I’m able to chose it as well. Obviously that resets node and they are gone meaning you have error. I need to explore this a bit more and will get back to you. Also will try to give you and example how to use Try/Catch with Database Writer node.

Have a nice weekend,
Ivan

Hi Rene @renemendes !

Sry for a delay on this one. Here is an example how to use Try/Catch sequence while writing to Database. You have to use Catch Error (Var Ports) in order to get errors from database Writer node. For start I used Try (Variable Ports) but it can work with Data Ports as well. Here is a print screen.

Additionally I have done same using New Database Integration nodes. There you have DB Insert node that offers more possibilities in configuration and more information in data output port. Check these new nodes out as they are planned to be production ready in KNIME summer release :wink:

Workflow is attached. If any question feel free to ask.
2019_03_29_Try_Catch_DB_Writer.knwf (56.0 KB)

Br,
Ivan

1 Like

Hi Ivan @ipazin !

Thank you a lot !

1 Like