LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error File

Hi All !
 
I have a question. I know it's possible to define custom error codes using the Error Code File Editor. It works quite good but, does someone know if it's possible to pass parameters to this file ????  
 
For example, if i have an error like : Unable to find file "test.xml". I want to pass the name of the file (test.xml) in parameter to my Error File....  !  
 
I haven't found anything about that in Labview help...
0 Kudos
Message 1 of 6
(2,973 Views)
If you want to do something that customized, I recommend you display a message box programmatically. This is by wiring the error cluster into a case structure and displaying the exact message you would want.
0 Kudos
Message 2 of 6
(2,969 Views)

Thanks for your answer jaime...

But that's exactly what i want to avoid... I find really useful to write all error messages in an external file. For example if i want to translate my application , i only have to change the Error File. And, if i need to correct a message , i don't have to go in the application, and search for hours every vi concerned by this message...  

But as i said, the problem is I think it's not possible to pass parameter with this solution... I hope I'm wrong, cause every modern language allow such things !

0 Kudos
Message 3 of 6
(2,965 Views)
Strictly speaking, this is not a failure of the language, as you alluded to in your last post. LabVIEW allows you create parameterized strings - that's what the "Format Into String" function is for. In all of my applications I have a set of error handling routines I use and I have an application-specific error codes file that's actually in xml format. In your case you can either do the same thing or write a simple wrapper around the stock error handling functions that will perform substitutions on the strings read out of the error code file that the Error Code File Editor creates. That would allow you to do what you want to do.
0 Kudos
Message 4 of 6
(2,962 Views)

Hi smercurio_fc !

Ok, you were right.. it is maybe not a problem with the language... but this could be easier! As you said, if you want to pass parameters you should write some code... In my case, the function Format into String was not really adapted. I wanted to create a subvi that search the string into the error file and replace the tags by the parameters. But you don't know in advance the number and the type of the parameters. For example in one message you can have 2 doubles as parameters and in the next only one string... In the function "Format into String" you must specify the correct number and types of parameters....

Well, I rewrote a little vi that suit my needs, and it works like I wanted (I pass a array of strings as parameters). But I still think this could be improve....

0 Kudos
Message 5 of 6
(2,956 Views)


Well, I rewrote a little vi that suit my needs, and it works like I wanted (I pass a array of strings as parameters). But I still think this could be improve....



Well, you'll certainly get no argument from me on this one, as you're definitely right about this.
0 Kudos
Message 6 of 6
(2,940 Views)