Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 67020

Custom error handling - Can I pass a description?

$
0
0

Aiming to reduce the frequency with which I litter my code with comments like "#ErrorCode: Place an error here!", always intending to later update the Error Code file, then choose from an error ring rather than just a custom error with a number from the top of my head (in the user range), I'm looking at ways to build a library for simple error handling.

 

I've got something that works semi-reasonably, but since the errors aren't stored in a custom error file, the error indicators refuse to give me a description. Is there something I can do about this other than a) create a custom error file, or b) store the message in the 'source' string?

 

Below is an image of one of the VIs I've written. It passes errors to an Actor for logging and pushes an error onto the Error Out indicator - it is called indirectly by VIs in other places which ideally should just need a boolean (error or warning?) and an error code (I32 coercion from enum is the current plan). I also tried using the General Error Handler (with a bundle-by-name after to force the status flag) but this also doesn't add a description. The message is found in either case, but I can't get it to an indicator, only to my logger via the message I've set up. Should I be happy with this? I suppose often error indicators are not visible, either being hidden or in subVIs with closed FPs...

 

eHandler.png

 

Edit: There should be a 'Equal to Zero?' check on the Code before execution, otherwise I get the source with a 0 code and warning...


Viewing all articles
Browse latest Browse all 67020

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>