kawait Posted June 7, 2006 Report Posted June 7, 2006 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, Quote
Yair Posted June 7, 2006 Report Posted June 7, 2006 Define your errors in advance and make sure the code knows what to do when encountering each error. Make sure to have unique error numbers. You can try looking at the error handling section here for an article and some VIs. Quote
crelf Posted June 7, 2006 Report Posted June 7, 2006 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). Quote
kawait Posted June 8, 2006 Author Report Posted June 8, 2006 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? Quote
Mike Ashe Posted June 8, 2006 Report Posted June 8, 2006 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 Quote
crelf Posted June 8, 2006 Report Posted June 8, 2006 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 Quote
kawait Posted June 13, 2006 Author Report Posted June 13, 2006 Sorry for my late post. Thanks Michael and crelf! your solution is a lot more elegant than mine. Quote
crelf Posted June 13, 2006 Report Posted June 13, 2006 Sorry for my late post.Thanks Michael and crelf! your solution is a lot more elegant than mine. No worries - that's how you learn I hope that you'll be able to teach us a thing or two one day! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.