LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
David_L

Clear specific error

Status: Completed

Implemented in LabVIEW 2014

Good programming practice says to handle your errors.  If you want to clear a specfic error, you have to do some variation on the following code:

 

ClearSingleError.png

 

Since this can be pretty cumbersome in your code, I would love to have a Clear Specific error VI/function that will do exactly this.  It can also be polymorphic and accept an array of multiple errors.  To make it even better, you could probably merge it with the existing clear error VI and set it up where if the error input is empty, it clears all errors.

 

CaptainKirby made a nice community example that does all this, but I'd like it to be on the palette for everyone to use...

https://forums.ni.com/t5/Example-Code/Clearing-a-Specific-Error-From-The-Error-Cluster/ta-p/3517242

 

21 Comments
David_Grucza
Member

 

 

 

David Grucza, CLD
Darren
Proven Zealot
Status changed to: In Development
 
crossrulz
Knight of NI

Yeah!  In development!  It might be a little late in the game to throw in suggestions here.  But I'm going to anyways.

 

What I have for my reuse library is a polymorphic VI.  The three polymorphic instances accept either a scaler integer, a 1D array of integers, or a boolean.  The instance to call is based on the input type.  So the scaler version does a simple check for that error and clears the error if it matches.  The array does a search of the current error code in the array of codes to clear.  The boolean either clears all or none.  All of these have an output for whether or not the error was cleared.  This output is very important when dealing with things like file I/O (read past the end of file causes an error, clear that error and stop your loop when that error is thrown).

 

My VI is also short to allow wires to go above it.  I doubt NI will do this, but I can hope.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
AristosQueue (NI)
NI Employee (retired)

With some minor tweaks, Darren and I are proceeding with a VI that looks pretty much like the one suggested in the idea. We thought about a polyVI, but there were more issues with pushing that forward on short time scale left for 2014.

Darin.K
Trusted Enthusiast

I must be the only one who primarily goes in the opposite direction.  I have VIs to only pass specific errors, or ranges of errors.

AristosQueue (NI)
NI Employee (retired)

Darin.K: That is definitely less common in my observation. If you white list "I only care about these errors", it is generally because you've decided that all other errors are fine to ignore, but it is very very hard to know all the possible errors that an given function can generate. If an error occurs that you never thought about, you generally want it to come through rather than being filtered.

Darren
Proven Zealot
Status changed to: In Beta
 
James@Work
Member

And, one more VI that I may soon be able to eliminate from my re-use library.

It will be fun to do a Find and Replace All for this function if it supports arrays.

Please, use my connections and icon... Smiley Very Happy

 

Clear Specific Errors.png

 

 

 

Tech Advisor - Automation
LabVIEW 5.0 - 2020
crossrulz
Knight of NI

As Stephen stated earlier, it will only clear a single error.  If you want to discuss it more, I suggest you join the beta and join the conversation on that board.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
AristosQueue (NI)
NI Employee (retired)

James@Fann: Sorry... the beta deadline for changes to this function has passed. We are in final release stage. Darren and I did discuss the polyVI option for providing array support, but when he and I looked into this idea in January, we were told we could only make the change for 2014 if we did it with no mutation to user's existing VIs -- and swapping out a regular VI for a polyVI counts, but using an unused terminal on the conpane does not. The scalar filtering seemed more common in our judgement -- and we admit that was totally subjective. We were also guided by the fact that the scalar version was the one that had garnered the Kudos here on the forums. We are unlikely to revisit it in 2015. I'm sorry, but this is one VI you're going to have to keep in your personal toolset.