LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Error Handling

Solved!
Go to solution

Hi everyone, I have a question dealing with Custom Error Handling.  

 

I always use the Error In and Error Out clusters within my VIs.  I have a VI that calls a .dll library using the Call Library Function Node and if the "Status" output parameter of the library function does not equal 0 this means the library function failed.  The Error In and Error Out clusters will not interpret this an an error.  I am trying to figure out how I can force the Status byte output into my error cluster so that no other code is run if the output parameter byte is anything other 0.

 

What is the most efficient way to do this?

 

Thanks!

0 Kudos
Message 1 of 4
(1,486 Views)
Solution
Accepted by topic author hobby1

Just use the Error Cluster From Error Code VI.


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
Message 2 of 4
(1,482 Views)

Crossrulz,

 

When using the "Error Cluster from Error Code.vi" how do you include a "Title" in the error message?  Right now I get the following:

 

Untitled 1<ERR>
Error 5000 Occured

 

Also, since anything other that zero for error code will set the error cluster status to TRUE, can we use any error code fed in other than 0?  I know the LabVIEW predefined error codes limit custom error codes to be in the range of: 

 

The following ranges of error codes are reserved for you to define custom error messages:

  • -8999 through -8000
  • 5000 through 9999
  • 500,000 through 599,999

Is it good coding practice to adhere to these error codes using the "Error Cluster From Error Code.vi"?

 

Thanks!

0 Kudos
Message 3 of 4
(1,451 Views)
Solution
Accepted by topic author hobby1

There is the Error Message input.  Did you try doing anything with that?

 

Yes, you should use those ranges that NI has allocated for cutom error codes.  The last thing you want is to use an error code an then LabVIEW finds the same error code and gives you a message that makes no sense for your error case.  I dare you to look at error code 7 and see what happens when you have two peices of code that use the same error code.


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
Message 4 of 4
(1,445 Views)