09-05-2012 11:42 AM
In an error cluster the "source" field often contains more than just the source of the error, for example if you use an error ring to define a custom error message the error message is put in the source string. What I would like is a way to strip out any extra information contained in this field so that I get ONLY the error source (i.e. name of or path to the VI which created the error) or an empty string if this information is not available.
So my first question is if a VI that will do this already exists?
If not and I need to write it myself I'm looking for a good resource that contains all the possible extra stuff that might be put into the source string by LabVIEW (I realize you can put anything you want to in there but I want to at least catch all the things that LabVIEW uses by default). Thanks.
09-05-2012 01:03 PM
The "Call Chain" function will return an array of the callers that can be passed to a concantenate string to give you the call chain.
Ben
09-05-2012 01:08 PM
To be more clear, I'm planning to write a general error handler and so I will only have the error cluster and will not be within the VI that created the error. In order to keep my error logging/messages more organized I want to have the code, source and message each in their own fields and so want to be able to separate the source field of the error cluster into the actual source and any extra info put into the message. Thanks.
09-05-2012 01:15 PM
If you are creating your own error handler you could use custom error codes. This gives you more control over the source information. If you error handler is a separate task you could create a message that you send your error handler that includes the error cluster with other useful information. The call chain as suggested does let you know who called the VI. You might be able to use that provided you are not trying to get the caller several levels up. If it is constant then you are OK, but if that varies it can be tough to grab the right caller from the call chain.