NI-Week Session: Advanced Error Handling in LabVIEW
#1
Posted 21 May 2009 - 11:20 PM
#2
Posted 22 May 2009 - 02:18 AM
One really important thing is how to report errors to users. Using the normal error dialog works nice for me, but users click it away most of the time and then give me a call 'your software is not working'. This is more about psychology than SE.
Felix
#3
Posted 22 May 2009 - 02:48 AM
Quote
I agree that usability is a key. I'd sure like to know who at NI thought it was a grand idea to share error 7 between File I/O and GPIB. "Why does my system have a GPIB error? ... Because your configuration is pointing to a file that doesn't exist." I have NEVER in 16 years had a user tell me that there was a File I/O error when an error 7 occured.
I used to be bad at error handling. (I hope Brian isn't using me as the bad example.) I now use a centralized error handler with an error passing vi that makes it simple. With a central error handler, I can log errors and command things to shutdown if severe errors occur.
#4
Posted 22 May 2009 - 02:59 AM
Quote
This is a historical flaw, I don't remember why that happend. They had no central repositiory for the error these times, maybe. But yes, every user is reporting you a GPIB error and never ever a file error.
Felix
#5
Posted 22 May 2009 - 06:01 AM
Quote
The common NI Error Code Database came into being in LV 6.1. Prior to that, every group had its own error codes, and of course, every group started counting at 1... except for one group ( I forget which) that actually used error code zero as an error. Ug. Nowadays we have reserved error code ranges for different products, and we offset the errors coming from the operating system into their own region. There's even two ranges reserved for our customers. :-)
#6
Posted 22 May 2009 - 06:14 AM
Quote
With a measly 6000 error codes. We've used a good portion of them, and undoubtedly they would conflict with other users' codes if were were ever to share code. I don't suppose we could have a few more of the 4 billion codes available? Whom do we have to waterboard to make this happen?
#7
Posted 22 May 2009 - 01:50 PM
#8
Posted 22 May 2009 - 02:04 PM
Quote
I use the <err> and <append> tags. This also avoids collisions with other errors I might define with the same code. (I have made two VIs: Overwrite error and Add Details to Error).
Moving the custom error messages around from project to project was to much hassle.
Felix
#9
Posted 22 May 2009 - 04:58 PM
#10
Posted 23 May 2009 - 12:43 AM
I basically have the whole error/message logging encapsulated in a by-ref class. This class:
- handles logging of the errors/messages to disk
- rotates logs every N days
- has an active thread of which optionally the UI can be shown as a (floating) window to see the realtime log
- publishes log events to interested subscribers through dynamic events
In the example here, on error, the default logwindow would be shown (which shows all messages since application start). Whether or not you want that depends on the type of application and where you are in the development cycle. I usually use the catched event to determine what error occured and decide what to do with it (e.g. ignore it, show in a nice UI, quit app, etc.)
#11
Posted 23 May 2009 - 02:34 AM
I use a FGV to store User event. On an error I generate a user event and pass the error to my event loop. In the dynamic error event case I have a state machine that can handle whatever error based on the error code, and then perform a custom action (i.e. shut down hardware, perform a certain action to correct the error, etc). I also log all errors generated to a text file.
This I have found works for me because the error dialogs are handeled in the event loop and I can still call other sections of code when the error dialog is displayed.
I am very interested in what other people do to handle their errors.
Dan
P.S. I hope NI gives you the big room for this presentation and doesn't have it at 4:00 on Thurs.
#12
Posted 23 May 2009 - 01:13 PM
QUOTE (ASTDan @ May 21 2009, 08:13 PM)
Quote
I use a FGV to store User event. On an error I generate a user event and pass the error to my event loop. In the dynamic error event case I have a state machine that can handle whatever error based on the error code, and then perform a custom action (i.e. shut down hardware, perform a certain action to correct the error, etc). I also log all errors generated to a text file.
This I have found works for me because the error dialogs are handeled in the event loop and I can still call other sections of code when the error dialog is displayed.
I am very interested in what other people do to handle their errors.
Dan
P.S. I hope NI gives you the big room for this presentation and doesn't have it at 4:00 on Thurs.
#13
Posted 23 May 2009 - 02:33 PM
Quote
As of this morning, the range 500000 to 599999 is now reserved for users.
#14
Posted 23 May 2009 - 09:18 PM
#15
Posted 23 May 2009 - 10:06 PM
Quote
Once an error code is allocated, it stays allocated, even if the product is end-of-life, because someone might still be using that product out in the world.
#16
Posted 23 May 2009 - 10:24 PM
Quote
Once an error code is allocated, it stays allocated, even if the product is end-of-life, because someone might still be using that product out in the world.
Oh totally! It would be crazy to decomission error codes.
#17
Posted 23 May 2009 - 11:20 PM
Quote
As of this morning, the range 500000 to 599999 is now reserved for users.
Thanks! :worship:
At the risk of pushing my luck, how about a range specifically reserved for OpenG? :ninja:
#19
Posted 26 May 2009 - 10:34 AM
Quote
Felix
Thats probably because everyone here uses the same topology. (centralised error handling). I use local error handling, since a lots different stuff has to happen if there is an error (not just tell the user) and that would make a centralised error handler a bit of a pig. The only common denominator is that I have to put a dialogue on screen and halt other processes execution ("Launch Error Dialogue.vi") while the operator decides what to do. In the meantime the process that threw the error tries to recover to a safe/stable state. The "Launch Error Dialogue" loads and runs (yup, you guessed it - the "Error Dialogue.vi) which logs to a file and filters the error to provide different options to the user (if required). It can be called from anywhere in the code and can remain on-screen, not show at all (i.e just log) or time out after n seconds (depending on the error level). It also does other things like set off a siren, change traffic light indicators etc. Nice and simple and just plonk it in your error case of the state machine.
One thing that hasn't been discussed so far is error levels.
In my system(s), I have severity/priority levels for errors (Information, System, Critical, Recoverable, Process and Maintenance). What do other people do to prioritise errors (if anything)?
The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones
If you have any trouble sounding condescending, find a C++ programmer to show you how it's done.
จิตใจที่ยิ่งใหญ่วิพากษ์วิจารณ์ความคิด จิตใจสามัญวิพากษ์วิจารณ์เหตุการณ์ แต่จิตใจที่ต่ำต้อยนั้นวิจารณ์เพียงผู้คน
OOP is an OAP. AOP is the POC!
Definitions
Encapsulation: Creating a vi
Class: VI template.
Instantiation: Placing the vi on a diagram
Inheritance: Create Control/Indicator" on a sub vi
Abstraction: A well written vi
Composition: Many sub vis
Singleton: A non re-entrant vi
#20
Posted 26 May 2009 - 05:12 PM
Quote
Once an error code is allocated, it stays allocated, even if the product is end-of-life, because someone might still be using that product out in the world.
Would it not be possible append a totally new errornum series to the end of the source field, introduce new error cluster definition side by side with old one and new error table?
Or even better introduce a new error wire with "fields" status, Errcode, code, (time[optional]), source and Errsource, and have conversions between the new and old error handling. Then better we could have better error message in the new series, while still keep the old in place.

Help
This topic is locked

Back to top
MultiQuote



















