06-28-2013 11:16 AM
Hi folks,
I want to include decent error handling in my Veristand project. From what I can tell so far, it is hard to get good error information out of your model or driver. (I am writing these in LabVIEW.) I was wondering what other people where doing.
At a minimum, I want to log that an error has happened and have some info about the error so developers can have something to go by. I would also like to log details to help debug errors in the event of un-anticipated errors. (I would love to log the values of all the inputs to the model/driver.)
What are best practices for error handling in models and device drivers?
Thanks!
06-28-2013 01:55 PM
I typically use a channel on the output of a custom device that holds the error code. Then I can see that value in any tools that can read channels. Since errors can be transient its usually good to do things like "last error code" "current error code" and "error count". If you want the full call chain for debugging you can print it to console.
I've seen people use Syslog protocol inside custom NI VeriStand plugins before: http://zone.ni.com/devzone/cda/epd/p/id/5980
This allows you to send messages in the custom code and view them in any Syslog viewer (there are many in the industry).
For custom labview models... you probably couldn't do syslog because they only have a "run" state. But you could at least do the other suggestions
06-28-2013 04:18 PM
I like the idea of using Syslog. I did not know there were syslog functions available.
I guess the problem with using this solution in a model is that there are init and clean up steps that models don't have states for?
I suppose I could convert my error data to an array of U8 and pass it to a Syslog driver as an outport?