I am new to KNIME and currently I am trying to find out how to implement a proper error handling for my data manipulation flows.
This is what I want to do:
- Read Excel File
- Data Manipulation
- Export CSV File
- if Success, then send email with success message
- if Error (e.g. Read Excel failed, because no file available), then send email with error message
I played around with Try Catch nodes but I really have no clou how to configure and use them correctly. In my mind the flow should look something like this but propably it is nonsense:
Can someone help me? How to configre the flow, that error message email is sent, if Excel Reader fails.
Hi there @NicerDicer ,
welcome to KNIME Community Forum!
You are on the right direction so here are couple of things that can help you make this work:
- Try/Catch sequence will catch errors only during node execution meaning error like one you mentioned before (file not available in Excel Reader node) will not be caught cause it happens during node configuration
- to somehow catch that file is missing and report it one can use String to URI or File Meta Info node. Both of them have option Fail if file does not exist which occurs during execution
- Try (Variable Ports) needs input so use String Configuration node for example. In it you can write your successful message
- See this example from KNIME Hub. It contains whole process plus logic after Catch Errors node
Try it out and if any questions/comments feel free to ask.
Thanks for your input @ipazin
Now my workflow looks like this:
Checking if the file exists works very well with File Meta Info.
But I am still struggling with the Catch Node.
When I execute the workflow, the Fail Node is always active, also if there was no error (see screenshot).
if you take a look at the node description in the AP or on the Hub you can see that the ports of the Catch Errors node do not work like you expect them to:
- Type: Flowvariable: Original input or default if execution failed.
- Type: Flowvariable: Reasons for Failure (if any).
You need to add an if switch that reacts to the default flow variable and enables the send email node
Hi there @NicerDicer,
just to add on @gab1one answer. In example linked in my first reply you can find logic (in Metanode after Catch Errors node) that determines if there was error or not. Try to make it work and if still have problems I can make you an example workflow to check.
Finally, I got it how to configure the nodes.
HI there @NicerDicer,
glad to hear you made it worked. Feel free to share you workflow on KNIME Hub so others can benefit from it as well
Can you please share a sample workflow. I am also facing the same issue. I am trying to read excel files from a folder. But when the file is not present I need to throw an error. I am using String to URI node but not able to configure the try and catch error nodes. Any help will be appreciated
HI there @sauravh86,
sry for a delay on this one. Do you still need help? If so can you explain a bit more how you are reading files from folder, which nodes do you use and what scenarios are possible?
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.