It depends. If you are using VISA then the ViOpen will generate some error messages as a result. You can check these errors in the VISA Programmer Manual. Page 5-85. NI-VISA Programmer Reference Manual
If you are not using VISA but the CWSerial functions in MS, then it is very simple. You can use the CWSerial ExceptionOnError function and then use the Event OnError for that function. That will generate an error. Hope this helps.