01-06-2010 09:50 AM
Hi,
I tried to create a set of labview error codes codes using tools-> edit error codes. A created a few test errors and saved the file in
C:\Program Files\National Instruments\LabVIEW 2009\user.lib\errors
The file called test-errors.txt appears as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<nidocument>
<nicomment>
First error code file Sean
</nicomment>
<nierror code="5000">
Device unstable
</nierror>
<nierror code="5001">
Device Critically Unstable
</nierror>
<nierror code="5002">
Press Stop or device will begin countdown to destruction
</nierror>
<nierror code="5003">
Destruction Countdown Commenced, all organic life will be destroyed with a 2 mile radius in t - 10 minutes
</nierror>
</nidocument>
I then designed a simple VI to test the error codes, see the attachment. However the error message do not appear in the error out source box.
Does anyone know why LabVIEW is not recognising my error codes?
Rgds,
Sean
Solved! Go to Solution.
01-06-2010 10:01 AM
Hi,
use the 'General Error Handler.vi' instead of the 'Error Cluster From Error Code.vi' that you are currently using. It should work then
01-06-2010 11:36 AM
Hi David,
Thanks for the reply.
It's not quite what I'm looking for. The general error handler throws up a popup window. My understanding of error cluster from errorcode is that the error should appear in the source box of the error out cluster, without throwing a popup.
Maybe I'm wrong and the error message is not supposed to appear in the error cluster from error code vi but this seems to contradict the LabVIEW Intermediate course manual.
Can anyone confirm this?
Rgds,
Sean
01-06-2010 01:00 PM
Hi Sean,
OK - i took another look at your test VI and probing on the error out wire shows the description, but you are right it is not shown in the control. I have attached a VI that should solve the problem (I have tested it and i works ok)
All I have done is to use the general error handler, which returns the error code and description, write the description to the error cluster and set the general error handler to 'no dialogue' so that the message is not displayed.
Like i say, it works but if there is a better solution let me know!
David
01-06-2010 01:24 PM
David,
The error cluster datatype should not contain the actual description of an error. When an error is generated, the only data in the error cluster will be the error code, status, and source. The source should contain the calling path of the VI that generated the error, not the error description. It is recommended that you use the Simple or General Error Handler VI to programatically view the error short description. If you want to interactively view the description you can right-click an error cluster control or indicator and select "Explain Error".
Chris M
01-07-2010 03:17 AM
David,
Thanks for the VI. That does exactly what I had expecte the error to cluster to do.
However, as CMal points out, it's not supposed to do that. that's my mistake, sorry bu thanks for all your help.
Rgds,
Sean