12-18-2013 01:51 PM
What is the recommended way to handle errors and successfully close connections such as TCP/IP communication or a connection to a database.
In a text based language I would typically do the following:
Connection myConnection.
Try
{
myConnection.Open();
myConnection.DoStuff();
}
Catch( someError)
{
}
Finally
{
myConnection.Close();
}
It is not clear to me in LabVIEW if I pass the error to the close connection if that VI will run.
IE)
or
Ideally when dealing with the error I would like to return my program back into a known state which in many cases is a closed connection.
Solved! Go to Solution.
12-18-2013 02:03 PM
NI stuff is usually pretty good about running Close VIs even if an error occurs.
In your example, the help for TCP Close explicitly mentions that the VI will run normally even if an error is wired into it.
Check the help files for default behavior and if you find any that don't attempt cleanup, I think you should report it as a bug.
12-18-2013 03:20 PM
Check out this Nugget from Darren:Functions that execute even with an incoming error