LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using custom error code file in a project

We're starting work a new project in a (small) multi-developper environment. We want to define a project specific custom error codes file, but I don't know where to put it! 

 

We're using SVN to do source code control, and want ideally for the error codes file to sit in the same project repository as the project itself (to ensure each developer has the most recent codes file available to them). However, labview doesn't appear to accept this as a valid place for an error file and so doesn't see it...

 

Is there a sensible way to deal with this? Like I say, ideally I should be able to just have my error codes file as part of my project and labview should see it... why doesn't it?!

 

Any help gratefully recieved!

 

Paul 

0 Kudos
Message 1 of 9
(6,346 Views)

psmorris wrote:

Is there a sensible way to deal with this? Like I say, ideally I should be able to just have my error codes file as part of my project and labview should see it... why doesn't it?!


Short answer: Because that's the way it was designed. Yeah, I know. That's why I have my own custom error handling routines that are able to use a file from wherever I damn well please to keep it. 

 

The LabVIEW Error Code File Locations lists the locations that the development environment uses.

Message 2 of 9
(6,335 Views)

The way I get around that problem is to have a separate routine that reads my own custom error files for a project (or a VI that has a constant containing that information as part of the app). Then, I have a VI called something like "Get Custom Error Codes" that will return an array of codes and messages which, when wired into the General Error Handler (The Simple Error Handler cannot be used for this), gives the same result as putting a LabVIEW error XML file into the appropriate location. This also has the advantage that I can re-use error codes in different apps without causing a big headache.

 

Shaun 

 

PS. I also frequently create a VI that takes an ENUM representing my custom errors (that internally gets converted to the appropriate code, etc) and builds the appropriate error cluster, so that both other developers and myself dont have to worry about remembering which error code they should be using at a given point.

Message Edited by shew82 on 06-30-2009 11:31 AM
Message 3 of 9
(6,322 Views)

Dear smercurio_fc and Shaun,

 

Many thanks for the advices and tips. Could you share your custom error VIs? It would very valuable and save time as well.

 

/ Leif

0 Kudos
Message 4 of 9
(6,179 Views)

With the default NI method, all custom error files in the folder /user.libs/errors are copyed inside the final executable file (if you are building). Do you think this is "safe"?

I mean what happens if two error files define the same error code?

In a big project or multi-developer project, how can I know automatically that I have the correct files, latest files, that I am not overwriting an already existant code?

Do I need to manually scan the files just to check if the custom code was already defined?

 

At this point, if all this is true, wouldn't it be more convenient to just create an INI file like:

 

[ErrorCodes]

5001=timeout error.

5002=checksum error.

5003=wrong command.

etc...

 

and just import this file at the beginning of the main VI (+ use the General Error Handler)?

This  approach let you put the errors ini file wherever you want, in the svn repo for multi-user, so that it is synchronized together with other files of that particular project.

 

But this approach cannot build the error file inside the executable (like in the case of the NI default XML-styled custom error file).

 

Now I'm doing some tests about this topic.

 

cheers

 

Message Edited by Slyfer on 04-02-2010 09:24 AM
0 Kudos
Message 5 of 9
(6,066 Views)

Done some experiments.
Labview 8.5.1 when it is launched, PRE-LOAD the xml-errors defined in the files located in \user.lib\errors.
So remember to restart labview if you define new error code files, to apply changes (you don't get new files messages)

 

What happens if you define the same code in three different error code files?


Errors are appended, and you get this:

 

 

Clipboard01.jpg

 

the order of the description is unknown

0 Kudos
Message 6 of 9
(6,051 Views)

it is not possible to deploy custom error code files in the <app_folder> when using the builder (not the installer...the builder only).

I put them in "always included", they are copied but LV runtime doesn't seek into the application "root" folder.

It seeks in its path (\shared\lv runtime\etc..).

 

0 Kudos
Message 7 of 9
(6,046 Views)

Rather than having a Custom Error Codes File, you could create a Custom Error Codes VI, made specifically for the project or product. This works for me, and there's no mistaking where it is / how to get to it / how to include it in a release document.

Richard






0 Kudos
Message 8 of 9
(6,031 Views)

I just create a hardlink in windows from my target error file (in my repository) to the Labview\user.lib\errors folder.

 

From elevated command prompt:

mklink /H "C:\Program Files (x86)\National Instruments\LabVIEW 2013\user.lib\errors\ErrorFile-errors.txt" "C:\Repository\ErrorFile-errors.txt"

 When the error file is changed using the "Error Code Editor" the file gets updated and the linked repository file also gets updated.

 

Hope that helps.

Message 9 of 9
(5,184 Views)