Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
2 ratings:
 5 out of 5     Rate this Document

How Do I Use Custom LabVIEW Error Codes in TestStand?

Primary Software: LabVIEW Development Systems>>LabVIEW Base Package
Primary Software Version: 7.1
Primary Software Fixed Version: N/A
Secondary Software: TestStand

Problem:
I want to define custom error codes for my TestStand/LabVIEW application. I have found documentation explaining how to do this in LabVIEW, but how do I incorporate TestStand?

Solution:
Custom error codes in LabVIEW can be implemented in two different ways: with the General Error Handler.vi or with an xml file. This article discusses the latter option.

All the error codes in LabVIEW are defined in an xml file (C:\Program Files\National Instruments\LabVIEW 7.1\resource\errors\English\LabVIEW-errors.txt). Error codes 5000-9999 are intentionally left undefined for custom use. Theoretically, you could modify the LabVIEW-errors.txt, but this is not recommended. Instead, LabVIEW includes a tool to help you define your own Error codes file. Depending on where you place this file, you can access the same errors in both LabVIEW and TestStand. The steps below outline this process:

  1. Within LabVIEW, go to Tools » Advanced » Edit Error Codes...

  2. It will prompt you with "Create new error code file or open an existing one?"

  3. Click "New." Later, if you want to modify/add/remove the error codes you can come back here and select "Open."

  4. You can enter any comments you want for the file, but they are not necessary.

  5. Click the "Add..." button and you'll get a dialog box asking you for an error code (default 5000) and a description.

  6. Enter your error code and description and click "OK"

  7. Continue clicking the "Add..." and "Delete..." buttons as needed to add and remove error codes

  8. When you are finished, select File » Save

  9. The default location (C:\Program Files\National Instruments\LabVIEW 7.1\user.lib\errors) will allow LabVIEW to access the new error codes, but not TestStand. Instead, place the error code file in C:\Program Files\National Instruments\Shared\Errors\English.

  10. Note that you must save it with the extension -errors.txt. For example, xxx-errors.txt, where "xxx" can be anything.

  11. Neither LabVIEW nor TestStand will be able to read the new error codes without a restart, so shutdown both if they are open.

The steps above should work as long as you are in the development environment. If you plan to deploy, you should put the error code file in C:\Program Files\National Instruments\Shared\LabVIEW Run-Time\7.1\Errors\English. Refer to the related links below for more information.

Related Links:
Developer Zone Example Program: Handle TestStand Runtime Errors

Attachments:





Report Date: 07/08/2005
Last Updated: 09/20/2007
Document ID: 3N7EE4S9

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit