LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format Custom Error Message

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.

0 Kudos
Message 1 of 3
(2,404 Views)

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, 

Applications Engineer
0 Kudos
Message 2 of 3
(2,361 Views)

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

0 Kudos
Message 3 of 3
(2,350 Views)