Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Error Handling In A Class Module

To signal errors from within a class method, use the Error.Raise method and bubble it back up to the server. Check the docs for Error.Raise and the books online. One caveat is that errors in Class_Initialize and Class_Terminate do not bubble back up. Like errors in an event procedure of a form module, they're not in the client's call tree. If they are untrapped, the OLE server will terminate abruptly. On an out-of-process server, your client will be left with invalid references. If your server is in-process (an OLE DLL), the situation is much more serious because your client will also terminate abruptly. (When you're in the same process, your fatal errors are your client's fatal errors.) Therefore, always protect Class_Initialize and Class_Terminate with bulletproof error-trapping, and never raise errors in them.
A. Nicklas
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date