09-30-2008 03:20 PM - edited 09-30-2008 03:20 PM
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
09-30-2008 03:28 PM
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
09-30-2008 04:17 PM - edited 09-30-2008 04:17 PM
09-30-2008 04:32 PM - edited 09-30-2008 04:33 PM
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
09-30-2008 04:36 PM
09-30-2008 04:38 PM - edited 09-30-2008 04:38 PM
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.
09-30-2008 04:57 PM
09-30-2008 05:02 PM
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.
10-02-2008 10:36 AM - edited 10-02-2008 10:37 AM