User | Kudos |
---|---|
8 | |
6 | |
4 | |
3 | |
2 |
Imagine you develop an VI that generates serious errors and you would like to force a calling VI to handle them. This ist not possible is the current and previous versions of LabVIEW.
Typically a library VI does not know how to recover or to handle the errors. The calling VI has the responsibility to handle such subVI errors or to propagate them to its caller.
The following VI snippet shows the idea of the error handler structure. I am using this work-around to imitate a try-catch mechanism, but still missing the complete list of possible errors of subVIs.
The calling VI needs to know all possible errors/exception that can be thrown by a subVI. At the moment a develeoper has to check the blockdiagram, VI description or manual to get this information. From my point of view this error/exception information must be part of the VI's public interface.
So, I propose an additional category in the VI Properties dialog: "Exceptions" and a "try{...} catch(exception){...}" programming structure.
- The Exceptions category should contain the list of possible exception that can be filled by the developer, Error/Warning code, description etc. Additionally the developer should be able to pass data to the exception handler, e.g. similar to dynamic event dispatching to the event structure. Of course the corresponding data types need to be defined somewhere in the VIs public interface, e.g. typedefs(.ctl) or subclasses of a generic exception class.
- The "try{...} catch(exception){...}" programming structure could be designed similar to the event structure with dynamic events. The timeout case would correspond to the try-block, other cases implement the catch(exception)-blocks. Since exception are part of the VI's public interface, possible exceptions coud be selected from an context menue that contains all possible exceptions of all subVIs in the try-case. All exceptions not handled here will be propagated to the calling VI. Of course this unhandled exception become automatically inserted in the exception list of the exception-category of its VI-Properties.
- Missing exception handling when using subVIs that have defined exceptions will break the VI Run-button.
I think it is absolute necessary to become able to force a subVI user to deal with possible exceptions. At least all VIs contained in vi.lib should have at least an explicite error list in its VI Properties as part of their public interface.
What's your opinion?
Regards Holger
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any idea that has received less than 6 kudos within 6 years after posting will be automatically declined.