Send error message


I am doing some communication with LabVIEW as the server, and RobotStudio as the client. I am communicating via Sockets. What I am trying to do, is to have RAPID send LV the error number when it encounters an error. Is this possible? Because when RS encounters an error, it stops the program, thus no longer connected to LV. Is there a way to have RAPID send the error number to LV right before the program stops and communication is lost?

Thanks for any help,