vtulluru / node-red-contrib-oracledb-mod

MIT License
4 stars 9 forks source link

Trigger the catch node on error #33

Closed JheSue closed 10 months ago

JheSue commented 1 year ago

Issue Description

In the node-red-contrib-oracledb-mod module, when attempting to simulate an exceptional case (e.g. inserting a duplicate primary key), the Oracle database exception is correctly logged in the console. However, the exception is not thrown: I tried using the 'catch' node to handle exceptions thrown by the oracledb node, but the 'catch' node is never activated, resulting in the flow hanging indefinitely.

Solution

I noticed that in cases of exceptions, the oracledb module fails to trigger the 'catch' node correctly, causing the exception to go uncaught. After investigating the source code, I made the following changes to address this issue:

requestingNode.error("Oracle query error: " + err.message + ", errorCode:" + errorCode, msg);

This issue is similar to #5 .

I have tested this fix in my local environment, and it successfully triggers the 'catch' node to handle exceptional scenarios, allowing the flow to continue running without hanging.

Testing Environment

Commit Details

I have made the necessary changes and tested them in my local environment. I am confident that this solution addresses the issue of exceptions not being properly caught. If you have any suggestions or feedback, please feel free to let me know. Thank you for your time and review!