LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Cancel Error on Match with two errors?

I'm trying to do a better job of error handling in my code library and came across using the Exception actions input on the General Error Handler under LabVIEW help.

 

While logging onto a wireless internet device with a DataSocket Read, prior to the device powering up, I will receive either a 56 error or an 1184 error.

I was wondering if anyone can tell me what I'm doing wrong.  It seems that only my first error is canceled correctly (56).  This is true if I change the order, for example make 1184 the first error canceled.  Than it will be canceled on 1184 and 56 will display an error.  How do you cancel both correctly?

 

Regards,

 

-SS   

 

Message Edited by ShotSimon on 09-30-2008 03:20 PM


0 Kudos
Message 1 of 9
(5,471 Views)

If you open up the General Error Handler.vi you will find that it only looks for one exception and then handles any other error.  So the first error handler cancels the 1184 error and displays the 56 error.  The second error handler will then cancel the 56 error, but since it was already displayed, you do not notice that.

 

I would handle the exceptions before calling the error handler.  Put the errors you want cancelled into an array and match them in a loop.  If found, reset the error and continue.  If not found pass any other errors to the General Error handler.

 

Lynn 

Message 2 of 9
(5,466 Views)

Would this work?  -SS

Message Edited by ShotSimon on 09-30-2008 04:17 PM


Message 3 of 9
(5,454 Views)

Nice solution! I think you have to negate the boolean. You want the error to be erased (i.e. set to False) if one of this codes turn up.

 

Daniel

 

Message Edited by dan_u on 09-30-2008 11:33 PM
Message 4 of 9
(5,448 Views)

I'm learning very slowly from Altenbach and others, your right I just figured out the error needs to be negated.  -SS



Message 5 of 9
(5,445 Views)

Oh, sorry, my mistake. If it's none of the error codes, you'll set the error to true! I think you need a case structure to avoid that.

 

Message Edited by dan_u on 09-30-2008 11:38 PM
0 Kudos
Message 6 of 9
(5,441 Views)
I just added 0 to the constant array...I think that will work.  -SS


0 Kudos
Message 7 of 9
(5,424 Views)

Should work in most cases. Just be careful, some VIs return status messages in the error code (e.g. the FTP VIs). Warnings will also be turned into errors.

 

0 Kudos
Message 8 of 9
(5,421 Views)

OK here is my solution to cancel warnings as well.  Not really happy with it but it works for ignoring certain errors and warnings.  Technically I should still log the errors and warnings but I have to take error handling one step at a timeSmiley Very Happy  -SS

 

Message Edited by ShotSimon on 10-02-2008 10:37 AM


Message 9 of 9
(5,360 Views)