"WSeeger" <ws******@yahoo.com> wrote in message
news:b9**************************@posting.google.c om...
When creating a new class, is it encouraged to always include error
handling routines within your LET and GET procedures? It's seems that
most text books never seem to include much about error handling within
classes. Just hoping to hear some programmer's thoughts on error
handling.
Okay, here are some thoughts on error handling:
All programs should have a good, well organized, error handling scheme. It
should guarantee that no user will ever see a "VB Runtime Error" and get shut
down; that if something goes wrong, as much of the data as possible is saved;
and that the user gets some hint as to what they should do next when an error
occurs.
Always including error handlers in every procedure is not a good or well
organized error handling scheme. Try to identify the appropriate level at which
errors should be trapped. It might be the initial user event, the routine it
calls, the nested routine it calls in turn, or an object let procedure. Do you
need to slam on the brakes, or just make a note of it?
Error handlers slow down program execution. A simple Let/Get pair, if they are
typed (not Variant), may not do anything that can cause an error - invalid
assignments wil be an error in the calling procedure. So no, it is not
encouraged to always put error handlers in Let/Get procedures, especially if the
objects are used inside loops millions of times.
It is sad that "most text books never seem to include much about error
handling". It is well worth spending the time to get it right, if the program is
going to be used much.