LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Error Handler.vi ignores error code?

Solved!
Go to solution

I'm trying to understand the behavior of Simple Error Handler.vi, and it's confusing me because it doesn't appear to be correctly ignoring the error code I give it.

 

According to the documentation, if I provide an error code, then:

If error in indicates an error, the VI ignores error code. If not, the VI tests it. A nonzero value signifies an error.

 

But my observation is that when error in indicates an error, the VI always shows a dialog even when given an error code. Instead, I am using the General Error Handler.vi and providing both an exception action (cancel error on match) and an exception code to get the behavior I want.

 

What am I misunderstanding?

 

HandlingErrorsPanel.png

 

HandlingErrors.png

0 Kudos
Message 1 of 5
(3,853 Views)

@MacNorth wrote:

I'm trying to understand the behavior of Simple Error Handler.vi, and it's confusing me because it doesn't appear to be correctly ignoring the error code I give it.

 

According to the documentation, if I provide an error code, then:

If error in indicates an error, the VI ignores error code. If not, the VI tests it. A nonzero value signifies an error.

 

But my observation is that when error in indicates an error, the VI always shows a dialog even when given an error code. Instead, I am using the General Error Handler.vi and providing both an exception action (cancel error on match) and an exception code to get the behavior I want.

 

What am I misunderstanding?

 

HandlingErrorsPanel.png

 

HandlingErrors.png


The first part of the documentation reads:

 

"Indicates whether an error occurred. If an error occurred, this VI returns a description of the error and optionally displays a dialog box."  It's not too clear unless you think about it in terms of how LabVIEW reports its errors.  Errors are written to the error cluster which, if you've been practing safe programming, is propagated throughout the application, so it makes sense that any error handler would look at that first.  This is consistent with standard error out functionality.

 

edit:

I'm not sure why you have those indicators up.  They are showing what I would expect them to be showing.  ("An error occured" for the first two, "an error was cancelled out" for the third.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 5
(3,835 Views)

@billko wrote:
PS - you don't need that sequence structure.

Actually here it is needed to make the popups appear in defined order. Without the sequence structure they could appear in random order and it would be hard to correlate the popups with a specific subVI instance. 😉

 

(Of course we could force a defined execution order by sequecning along the error cluster instead of branching it. ;))

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 5
(3,826 Views)
Solution
Accepted by topic author MacNorth

MacNorth wrote:

 

I'm trying to understand the behavior of Simple Error Handler.vi, and it's confusing me because it doesn't appear to be correctly ignoring the error code I give it.

 

According to the documentation, if I provide an error code, then:

If error in indicates an error, the VI ignores error code. If not, the VI tests it. A nonzero value signifies an error.

 

But my observation is that when error in indicates an error, the VI always shows a dialog even when given an error code.


There are two different ways to interpret ignore in the sentence: "If error in indicates an error, the VI ignores error code."

    1. (the intent) If error in indicates an error, the VI does not use the error code.
    2. (my take) If error in indicates an error, the VI suppresses any that match the error code.
0 Kudos
Message 4 of 5
(3,802 Views)

@billko wrote:

@billko wrote:
PS - you don't need that sequence structure.

Actually here it is needed to make the popups appear in defined order. Without the sequence structure they could appear in random order and it would be hard to correlate the popups with a specific subVI instance. 😉

 

(Of course we could force a defined execution order by sequecning along the error cluster instead of branching it. ;))


Oh I didn't even think about popups because I almost always supress them!  (I was just thinking about the indicators.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 5
(3,788 Views)