Catch node not working as expected


Hello, I'm new on this so I'm not sure what could be wrong.

I'm using a flow to insert data from a http form into a table in a postgresql database. My problem is that I wanted to use the "catch node" so if the user enters an information twice, as I have that column set as primary key on my data base and error message would be send back. What I wanted to do was to notify the user is the information provided already exist in the database by creating a template to display the response in case that happens, or if the information is not repeated to display an http template to show it as a successfull registration.

My idea was to use a catch node connected to a node switch, so if there is an error comiing form the postgresql node it will trigger the template saying the error. And if there was not, the switch it would trigger the template saying it was a success. Although, when I try to send the query, knowing it will return an error from the postgresql node. It is shown in debug window as a general error but it is not show from my debug node connected to the catch node as a message which is what I want.



Which database node are you using? It sounds like it isn't reporting the error properly for the Catch node to handle. If you can identify the node/module you are using we can look to see if that is the case and whether an issue/pull request can be raised against it to fix.



It is called "node-red-contrib-postgres".
This is an example of what I mean, I would like to have the error presented as a msg coming from my debug node.



guess there is no solution for me :frowning:




A quick look at that node's code shows it is not logging errors in a way that will trigger the catch node:

Next step would be to raise an issue against the node to get that fixed.


1 Like