LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to ensure I get just the error source

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.

0 Kudos
Message 1 of 4
(3,002 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 4
(2,990 Views)

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.

0 Kudos
Message 3 of 4
(2,986 Views)

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.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 4
(2,984 Views)