LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Error Codes in Exe

Solved!
Go to solution

Hello 

 

I am trying to include a custom error code file with my exe.  I put my custom error codes file in LabVIEW 2017\user.llb\errors.  I checked the box in the application builder to copy error code files.  I even put my custom error code file in my project and include it in my buld under user.llb\errors.  I also put my custom error code file in D:\National Instruments\Shared\Errors\English

 

The exe is not using my custom error code files.

 

Any help would be appreciated

 

Thanks

Dan Shangraw, P.E.


   

0 Kudos
Message 1 of 6
(4,150 Views)

Hi ASTDan!

You should store custom error files into a special folder <LabVIEW>\user.lib\errors
When launching LabVIEW, it will load these files, if you change or add files, you have to restart LabVIEW for these changes to show up.
If you want to modificate the error files, you should use the Edit Error codes tool in Tools>> Advanced

I hope that helps you!
Best Regards, Monse.

 
0 Kudos
Message 2 of 6
(4,107 Views)

Hello Monse,

 

I have done that.  The problem is not in the development environment.  It is when I run the created exe.  The error is found when using LabVIEW however when I run the exe on a clean machine I get an undefined error.

 

Here is the exe and project

Dan Shangraw, P.E.


   

Download All
0 Kudos
Message 3 of 6
(4,085 Views)

Hi again!

Maybe you could try defining Custom Error Codes Using the General Error Handler VI
Complete the following steps to define custom error codes using the General Error Handler VI.

  1. Add the General Error Handler VI to the block diagram.
     Add  Find
  2. Right-click the [user-defined codes] input and select Create»Constant from the shortcut menu. An array appears.
  3. Double-click the numeric constant and enter a number within the range of -8999 to -8000, 5000 to 9999, or 500,000 to 599,999 in the array. For example, enter 5008.
  4. Right-click the [user-defined descriptions] input and select Create»Constant from the shortcut menu. Another array appears.
  5. Double-click the string constant and enter a description in the user-defined description array. For example, enter Ignore this message.
  6. Right-click the error in input and select Create»Constant from the shortcut menu. A cluster appears that contains a Boolean constant, a numeric constant, and an array.
  7. Use the Operating tool to set the Boolean control to TRUE.
  8. Double-click the numeric constant and enter the same number that appears in the [user-defined codes] constant.
  Note  As an alternative to steps 6 through 8, you can wire a numeric constant with the specified error code to the Error Cluster From Error Code VI. Then wire the error out output of the Error Cluster From Error Code VI to the error in input of the General Error Handler VI.
  1. Run the VI. An error dialog appears and displays the customized error code and description. Click the Continue button in this error dialog.
  2. Double-click the General Error Handler subVI and view the front panel. Switch to the VI in which you defined your custom error code, and run the VI again. Click the Continue button again and notice that the message text box on the front panel of the General Error Handler VI displays the same customized error code and description as the error dialog.

You also can define custom error codes by creating an XML-based text file and adding the error codes and messages to the text file.
Try this and tell me how's it going!

Regards,
Monse

0 Kudos
Message 4 of 6
(4,078 Views)
Solution
Accepted by topic author ASTDan

See correct locations of error codes file for exe:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P83iSAC&l=en-US

And creating installer to distribute exe with codes:

http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/dist_error_code_files/

0 Kudos
Message 5 of 6
(4,061 Views)

I manually put the error code file in the project/errors folder on the exe.

 

Worked!

 

Thanks

 

Dan Shangraw, P.E.


   

0 Kudos
Message 6 of 6
(4,053 Views)