LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

More user-friendly catching of exceptions in Call Library Node

OK, I know that according to NI they are already handling exceptions that occur in a Call Library Function Node by popping up a message, but I need to do the following:
 
- At least tell the user what happened with a more informative and less embarrasing message than the supplied one
- Be able to stop other concurrent while loops that might be running as while the message is on the screen other loops (that didn't make the call) are still running without notification that this one has stopped.
 
Any ideas?
 
Thanks
Anthon
 
0 Kudos
Message 1 of 3
(2,638 Views)
C++ has a structured exception handling. As long as your DLL does not catch an exception itself it will be passed up the call chain until there is someone that catches an exception or if nobody has cared to catch an exception the system will display a generic Exception has ocurred dialog.

So the solution is quite simple: Add exception handling to your DLL.

If you want to do this for DLLs you do not have the source code for, forget it: A caller has very little possibilities to determine why something has been gone wrong in a subroutine unless it has specific knowledge about that subroutine. That is why there is something like exception handling. Implement the interesting error catching at the place of the code that knows exactly what the code might have been doing and not in some top level code that can at best take a more or less generic error code to guess at the actual problem.

Rolf Kalbermatter

Message Edited by rolfk on 07-14-2006 09:42 AM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 3
(2,637 Views)

Thanks Rolf. 

Sure, one can't expect the caller to guess at what went wrong in the DLL, but I still think some control over what the generic message is that LabVIEW throws when an exception occurs is not an unreasonable request.  Yes, maybe LabVIEW's memory is corrupted by the DLL so I don't expect to gracefully shut down etc.  Also stating which DLL caused the exception will be useful.

I might have to write a wrapper DLL (that catches exceptions) around the 3-rd party DLLs I'm using. . .

Cheers

Anthon

 

0 Kudos
Message 3 of 3
(2,625 Views)