06-30-2010 12:02 PM
Hi. I am using Labview 2009 (v9.03f). I want to add my own error codes to LV. I intend to use the method where I define an XML file (with suffix "-errors.txt") containing my error codes and corresponding error messages, which then get treated the same as the LV errors. (http://zone.ni.com/devzone/cda/tut/p/id/3209#toc1). This seems like a good option in case of future language migration, and to prevent a whole load of hard-coded text through the code.
However, I want to be able to insert extra error information into my messages at run time. Eg. if a value is invalid, I want to be be able to show the invalid value, like this
"Error invalid value: <run time value goes in here>".
Basically, I want something a bit like the equivalent of the old sprintf in C, where you can specify a string with various formatting placeholders, and then provide a list of data to populate the placeholders.
Can I do this with the LV error handling?
Thanks for listening.
07-01-2010 05:10 AM
Hi,
I don't think thats a possibility with the LabVIEW Custom Error Code set, I can't really think of a way of getting what you are looking for but hopefully some members of the community might have some additional suggestions.
Kind Regards,
07-01-2010 08:26 AM
I would consider creating a custom error handler. When it detects the error codes which you have defined as having a runtime parameter, then it creates the string and inserts it right before displaying the error.
Lynn