LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Confused about the Error Ring customization options

The Error Ring:

 

Screen Shot 2016-04-19 at 12.35.46.png

 

is great to constructing custom error codes.

Documentation here: http://zone.ni.com/reference/en-XX/help/371361M-01/glang/error_ring_constant/

 

There are two ways to use it:

- define a Custom Error Code at Edit time

- define a new set of codes in a user-created XXX-errors.txt file using the Tools>>Advanced>>Edit Error Codes...

 

There appears to be a major difference between the two approaches.

 

In the first case, you can include string formatting codes and this results in the error code to automagically add input terminals to itself:

 

Screen Shot 2016-04-19 at 12.41.57.png

 

The problem is that this is only valid within the current project. Move to another project and there is no error 5003 to be found under the Custom Error Code section.

Documentation here: http://zone.ni.com/reference/en-XX/help/371361M-01/lvhowto/cust_errors_from_error_ring/

 

 

In the second case, you DO NOT have the option to include string formatting code (you can put some but nothing is going to happen):

 

Screen Shot 2016-04-19 at 12.46.59.png

However, since these definitions are saved in a specific XXX-errors.txt (in user.lib/errors), they can be used in any projects.

Documentation here: http://zone.ni.com/reference/en-XX/help/371361M-01/lvdialog/error_code_file_editor/

 

Why the difference and in particular, why is this cool formatting feature not available in the second approach?

 

Finally, I don't believe the user.lib/errors folder is the most natural location for such a generic resource. It probably should be in a user folder like the shortcut plugins are so that it can be shared between versions.

Message 1 of 14
(4,860 Views)

@X. wrote:

The Error Ring:

 

Screen Shot 2016-04-19 at 12.35.46.png

 

is great to constructing custom error codes.

Documentation here: http://zone.ni.com/reference/en-XX/help/371361M-01/glang/error_ring_constant/

 

There are two ways to use it:

- define a Custom Error Code at Edit time

- define a new set of codes in a user-created XXX-errors.txt file using the Tools>>Advanced>>Edit Error Codes...

 

There appears to be a major difference between the two approaches.

 

In the first case, you can include string formatting codes and this results in the error code to automagically add input terminals to itself:

 

Screen Shot 2016-04-19 at 12.41.57.png

 

The problem is that this is only valid within the current project. Move to another project and there is no error 5003 to be found under the Custom Error Code section.

Documentation here: http://zone.ni.com/reference/en-XX/help/371361M-01/lvhowto/cust_errors_from_error_ring/

 

 

In the second case, you DO NOT have the option to include string formatting code (you can put some but nothing is going to happen):

 

Screen Shot 2016-04-19 at 12.46.59.png

However, since these definitions are saved in a specific XXX-errors.txt (in user.lib/errors), they can be used in any projects.

Documentation here: http://zone.ni.com/reference/en-XX/help/371361M-01/lvdialog/error_code_file_editor/

 

Why the difference and in particular, why is this cool formatting feature not available in the second approach?

 

Finally, I don't believe the user.lib/errors folder is the most natural location for such a generic resource. It probably should be in a user folder like the shortcut plugins are so that it can be shared between versions.


The -errors.txt usage becomes even more mind-numbing when you try to use it with TestStand.  Then they have to go in the C:\Program Files (x86)\National Instruments\Shared\Errors\English folder if you want them to be seen by TestStand!  Of course, then there's no easy way to include it with a LabVIEW build.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 14
(4,842 Views)

What else do I need to know about errors.txt files and builds?

Does the file need to be explicitely part of the project?

Does it need to be copied somewhere in the destination folder?

0 Kudos
Message 3 of 14
(4,821 Views)

@X. wrote:

What else do I need to know about errors.txt files and builds?

Does the file need to be explicitely part of the project?

Does it need to be copied somewhere in the destination folder?


I guess I over-dramatized that part.  You include it explicitly and create a new destination directory in your build.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 14
(4,788 Views)

Now you're freaking me out!

First, where is that documented?

Second, what happens if the file is not included (or corrupted, or deleted)?

 

I found this CAR about error rings, but I don't think I need to worry about this just now: http://www.ni.com/product-documentation/52150/en/#522606_by_Category 

 

 

0 Kudos
Message 5 of 14
(4,762 Views)

OK, in fact, according to the docs, I should not worry about the errors.txt file, as it will be copied, provided I check the right checkbox in the Advanced tab in the build specification:

 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvdialog/app_settings_tab/

 

Copy error code files—Adds copies of XML-based LabVIEW error code text files from the project\errors and user.lib\errors directories to the run-time engine. 

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

 

I am just hoping I am reading this right...

 

 

0 Kudos
Message 6 of 14
(4,734 Views)

I guess the info is pretty scattered across LabVIEW and testStand docs, but the one that I had most trouble with was this one:

 

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

 

That talks about adding error codes to executables.  Since the application I was working on was intended primarily to be used in TestStand but was also meant to be built as a standalone executable I had to have my error codes reside in the errors\english folder, but I used a pre-build VI to pull them into the user.lib\errors folder, but if I had found this document earlier, I would've just included it in my build as I had mentioned above.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 14
(4,730 Views)

Thanks for that link.

So basically, if I understand correctly, the thing can become an horrible mess, since YOU can create a custom error file called custom-errors.txt and *I* can create a different one named the same way. If we both distribute our app to the same client, the second install will override the first, since the installer "installs [the files] in the Shared\LabVIEW Run-Time\x.x\errors directory, where x.x is the version of LabVIEW".

I can break your app and reciprocally. Well-done NI...

0 Kudos
Message 8 of 14
(4,715 Views)

@X. wrote:

Thanks for that link.

So basically, if I understand correctly, the thing can become an horrible mess, since YOU can create a custom error file called custom-errors.txt and *I* can create a different one named the same way. If we both distribute our app to the same client, the second install will override the first, since the installer "installs [the files] in the Shared\LabVIEW Run-Time\x.x\errors directory, where x.x is the version of LabVIEW".

I can break your app and reciprocally. Well-done NI...


That's why I have very explicit names for my error code files.  The whole error code thing feels kind of kludged, though.  I mean, add some errors to your text file and there's no way to update LabVIEW, except to restart.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 14
(4,688 Views)

Restarting LV sort of makes sense to me. It's similar to when you update your ini file.

But even then, I noticed that when I corrected a typo in my error codes (using the LV interface for that), when I re-opened the VI where the specific error was selected in the error ring, the text was not updated.

I had to reselect the error for it to update (not as bad as when you modify the text of a typedef enum and VIs using it break because enum constants displaying that specific value are not updated until you force update them).

I will have to experiment and see what happens in an executable when the errors.txt file is removed or modified...

Did anyone try that already?

 

0 Kudos
Message 10 of 14
(4,669 Views)