LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is proper way to create user-defined error arrays

I would like to create a subVI with all my user defined error codes and descriptions. I would like to place it into a subVI so I don't need to paste these arrays anywhere an error may happen. I have attached my attempt to do so. The Test Error VI doesn't work as I had hoped. I hoped it would obtain the proper description from the error code value wired into the Common Error subVI. Please suggest the correct way to address this desire. Thanking you in advance. ... RicK.
Download All
0 Kudos
Message 1 of 4
(2,888 Views)
RicK;

I have a method to define my own error codes, which I expressed in a previous answer. It turns out that some other LV programmers use similar methods.

Please, be advise that the range from 5000-9999 is specified as user defined error codes. Also, as oppose to what I mentioned in the answer, LabVIEW can return negative errors.

Regards;
Enrique
www.vartortech.com
Message 2 of 4
(2,888 Views)
Once I added an error code and description to the subVI and made the current values default, everything worked fine. I would use the error in input of the error handler instead.
0 Kudos
Message 3 of 4
(2,888 Views)
Rick,

You can find information on how to create your own error codes in the LabVIEW Help File by going to: Help >> Contents and Index >> Contents Tab: Debugging VIs >> Error Checking and Error Handling which contains several documents for this purpose.

Also let me attach a brief description for the User Error Codes that a partner here in NI give to a previous customer:
The General Error Handler.vi has many optional inputs. The two we are interested in today are the two along the top of the VI. "User defined descriptions" is an array of strings. "User defined codes" is an array of int32 values. The first array should list all the text descriptions for the new errors you'd like to add. The second array is the error codes for your new errors. An example
: Let's say your new error is going to be number 5001 and your text is going to be "Zero is not a valid input to this function." The first element in the string array would be your text, and the first element in your numeric array would be 5001. It is suggested that users use error code values between 5000 and 9999 to leave room for additional error codes that might come out in future Labview releases.

Now, some of you may be saying, "That works for a single case. But what if I use the General Error Handler in lots of places. Do I have to copy my input array all over every time I want to have my personal errors included?" No. Simply create a wrapper VI, such as the one provided here, that includes your personal errors as inputs. Then use that VI any place that you would use the General Error Handler or the Simple Error Handler. In this way, if LabVIEW later updates the functionality of the General Error Handler, your VI gets the benefits of that change without losing your own chang
es.

I hope this information may be of help, good luck!

Nestor Sanchez
Applications Engineer
National Instruments
Nestor
Message 4 of 4
(2,888 Views)