Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Defining Custom Error Codes in Text Files

LabVIEW 8.2 Help
August 2006

NI Part Number:
371361B-01

»View Product Info

National Instruments recommends that you use the General Error Handler VI to define custom error codes in the range of 5000 through 9999 and -8999 through -8000. However, you also can define custom error codes in the same range using the Error Code File Editor dialog box. Use this method if you want to use the same custom error codes with several VIs or if you want to distribute custom error codes with an application or shared library. If you want to distribute the custom error codes with an application or shared library, you must distribute the error code text files.

Complete the following steps to define custom error codes using the Error Code File Editor.

  1. Select Tools»Advanced»Edit Error Codes to launch the Error Code File Editor.
  2. In the Error Code File Editor, select File»New Error Code File to create an error codes file or select File»Open Error Code File to browse to an existing error codes file.
  3. Enter comments about the error codes file in the Comments about this file text box.
  4. Click the Add button to add an error code and description to the error codes file.
  5. You can select and edit the error code descriptions you enter using the Error Code and Error Text controls.
  6. When you are done editing the error codes file, select File»Save to save the error codes file in the labview\user.lib\errors directory.

You also can define custom error codes in the same range by creating an XML-based text file. You must name the text file xxx-errors.txt, where xxx is a name that you supply. The xxx-errors.txt file must use the following syntax exactly, including capitalization, spacing, and so on. You supply the italic text:

<?xml version="1.0"?>
<nidocument>
<nicomment>

This file describes custom errors for my VI.
</nicomment>
<nierror code="
5000">
Memory full.
Add more memory.

</nierror>
<nierror code="
5001">
Invalid name. Enter a new name.
</nierror>
</nidocument>

You can add your own comment between the <nicomment></nicomment> tags. In each <nierror> tag, you must define the error code number. Define the error code message between the <nierror></nierror> tags.

Changes to error code text files take effect the next time you start LabVIEW.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit