Defining Custom Error Codes to Distribute throughout Your Application

Complete the following steps to define custom error codes using the Error Code Editor dialog box. After you create your custom error code file, you can select the errors in the Select Error dialog box and you can distribute the file in an application or shared library.

  1. Select Tools»Advanced»Edit Error Codes to launch the Error Code Editor.
  2. In the prompt that appears, click the New button to create a new error codes file or click the Existing button 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 error code to edit the code and select the space under the Text column to add text for the error. Click the Add Error Code button to add another error code to the error codes file.
  5. To edit the error codes and descriptions, select the error code or text you want to change, and enter your edits. Select the Sort Error Codes button to sort the error codes in ascending order. If you want to delete an error code, select the error code and click the Delete Selected Error Code button.
  6. When you are done editing the error, click the Save button to save the error codes file in the LabVIEW\user.lib\errors directory. You must save the error codes file in the format xxx-errors.txt, where xxx is a name that you supply.

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.

Note Note  You must manually create an errors folder in the LabVIEW\user.lib directory to organize your error code files.

<?xml version="1.0" encoding="Windows-1252"?>
<nidocument>
<nicomment>

This file describes custom errors for my VI.
<nifamily familyname="Your Custom Errors" displayname="Your Custom Errors">
</nifamily>
</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. The <nifamily></nifamily> tag is optional. The text between these tags appears as the error category if you use the Select Error dialog box.

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