Jump to content
Sign in to follow this  
larsen

Management of user error codes/messages

Recommended Posts

In any serious application you check for errors and (try to) act sensibly on them. LV error cluster is the recommended carrier.

But I am lacking a useful method to keep an order in the different error codes. LV has a built-in error database for the ones defined by NI. User error are reserved in the code range...

National Instruments recommends that you use the General Error Handler VI to define custom error codes in the range of 5000 through 9999 and -8999 through -8000. However, you also can define custom error codes in the same range using the Error Code File Editor dialog box.

I tried both methods but they suffer different things:

General Error Handler VI is strangely complicated to apply for what little it can do, and the help for it is weird suggesting creating constants at the array input. Why does it have an array of user error codes/messages as input, when I cant use it as a kind of database for user errors?

Kind of database is precisely one of the things I am lacking to have a per-project central overview of all errors. Well, I could maybe use the General Error Handler VI as such but I would then want to make a local copy and initialize the user error codes/messages arrays to my own errors (make values default) and instatiate this in my vi's. Is that what was intended for this VI/ good idea?

Method 2) Using the Tools-->Advanced --> Edit error codes menu to create an xml file with all the custom error codes in. LV looks up in this database when handling error lookup. This is in principle a good idea, except it seems not posible to have one xml file per application, except if you build an application. In that case you can distribute your custom xml error file with the app. In the development situation you always refer to the file(s) in labview\user.lib\errors. And you are likely to have several ongoing project simultaneously. In addition you have to restart LV for the XML file to be re-read. What I would like would be the option to have a per-project user error table (hey, we have a project explorer now :thumbup: ). Any idea if this is posible?

In summary, good ideas on error management are welcome. LV help and LV examples are not very informative in that domain.

henning

Share this post


Link to post
Share on other sites

Hi Hennig:

I've had the same thoughts-- If I want to generate an error, I usually simply make an error cluster constant, and edit it to show what I want. I use a case selector with the error in wired to false, and my error cluster constant wired to true. In some cases, I'll use string manipulations and bundle the string into the error cluster to (for example) identify which stepper motor had the drive fault.

But how should we keep track of which error numbers we've used, and which we haven't and how do we make a summary of all the errors we've defined? It is nice if the users can refer to the error by unique number, rather than by copying the whole message to communicate with us.

Also, my method always ends up giving the "This error code is undefined. No one..." message with the simple error handler-- even if the string I put in the error cluster fully describes the problem. It would be nice to be able to shut that off-- I too find the general error handler method of defining all my error codes a little awkward for my needs-- I tend to live with the "Undefined..." message rather than dealing with the issue.

Sounds like something our scripting friends might have some suggestions on. I haven't got around to re-installing Open G since I went back to 7.1, but maybe there is something there?

At any rate, I share your interest & feelings on the topic.

Best Regards, Louis

Share this post


Link to post
Share on other sites
And you are likely to have several ongoing project simultaneously. In addition you have to restart LV for the XML file to be re-read. What I would like would be the option to have a per-project user error table (hey, we have a project explorer now :thumbup: ). Any idea if this is posible

I really like the idea of being able to define some error table on a per project basis. They already have conditional disable symbols on the project level, and that would be quite an addition. Sounds like a great Wish List item.

It is possible to use some error-handling templates and automatically build some error VIs for each project (using scripting or not). You can use an enumerated type for the errors, and then define some offset within the 5000-10000 region that your errors will slip into. I saw this in some freeware from Moore Good Ideas, and I am sure others have done similar things.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.