Jump to content

Custom Error Handling.....How?


Recommended Posts

Hi all LabVIEW gurus:

I am a novice of LabVIEW (~6 months experience), I am writing an application to read trace data from a network analyzer and do some analyses (sth like time-domain transform, optimization...etc). I am thinking about enhancing my application's error reporting capability by including my own error codes and messages (since many times I found that the default LabVIEW error messages are too cryptic to understand). Is anyone here who found LabVIEW default error handling unsatisfactory and has done some tweakings on it? I want to learn some tips and tricks from you guys.

Thanks,

Link to comment
I am thinking about enhancing my application's error reporting capability by including my own error codes and messages

My first suggestion (as always) is for you to RTFM. You'll find that LabVIEw reserves the ranges of 5000 to 9999 and -5000 to -9999 for custom user error code use, so there's plenty of room there for your error codes. One of the (by far) easiest methods of defining your own error codes is to use the Error Code File Editor (you'll find that under Tools>>Advanced>>Edit Error Codes) - it's an interface that helps you create an *-errors.txt file which is a file that contains all of your custom errors (it's actually a simple XML file). Basically, when an error handler gets and error in, it looks for the error code in your standard LabVIEW error files, then toolkit and add-on error files, and then your custom ones, so you don't really have to do anything special on your BD.

:!: dont' forget to include the custom *-errors.txt file in your installer build if you build executables (there's a specific setting for that in the builder).

Link to comment

yen and crelf, thanks for your response.

Besides more informative and readable error messages, my motivation of doing all these is that I really want very robust error logging (although my application doesnt really need that now, I think it would be a valuable feature as my application gets more and more complicated). Some days ago I tried to write a set of VIs which work on top of standard LabVIEW error handling VIs. But as I was coding them halfway I asked myself "Why I need to do all these? Someone should have done this before, even LabVIEW may have this feature bulit-in". So here I am. :)

Do I actually have to do it myself? If I have to, do you guys have any suggestion about the error logging?

Link to comment
yen and crelf, thanks for your response.

Besides more informative and readable error messages, my motivation of doing all these is that I really want very robust error logging (although my application doesnt really need that now, I think it would be a valuable feature as my application gets more and more complicated). Some days ago I tried to write a set of VIs which work on top of standard LabVIEW error handling VIs. But as I was coding them halfway I asked myself "Why I need to do all these? Someone should have done this before, even LabVIEW may have this feature bulit-in". So here I am. :)

Do I actually have to do it myself? If I have to, do you guys have any suggestion about the error logging?

It's been done, several times, several different architectures. Since you are new to LabVIEW you might want to pick up a couple of LabVIEW books. The first original LabVIEW book was written by Gary Johnson. I believe he included a whole library to do exactly what you are asking.

There is a new version coming out in July, if you can wait that long:

LabVIEW Graphical Programming

Cheers

Link to comment
Besides more informative and readable error messages, my motivation of doing all these is that I really want very robust error logging

Try this one out - I've used if for a while now. It logs errors form the error cluster to an ASCII file - one line per error with status code and description included. There's also a feature that allows you to limit the size of the error file (making it a FIFO).

Download File:post-181-1149805715.vi

It also needs this vi to check if an error log already exists (the vi creates one if it doesn't)

Download File:post-181-1149805736.vi

Link to comment

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...

Important Information

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