473,511 Members | 15,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error handling in property procedures

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.
Jul 17 '05 #1
2 3255
Well I'm all for it, however I wouldn't have the class display a message or
anything...

Say you have a form and a support cls module. In the class module you could
have error management, but instead of managing the error, I would just have
the class raise an error and manage the error (show message or log the
error) at the form level instead of it's class.

--
Stéphane Richard
"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.

Jul 17 '05 #2

"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.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
10284
by: dtwilliams | last post by:
OK, i'm trying to do some error checking on stored procedures and am following the advise in Erland Sommarskog's 'Implementing Error Handling with Stored Procedures' document. Can anybody help...
6
4714
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
3
3071
by: WindAndWaves | last post by:
I am writing error handling procedures at the moment. Here are some questions: 1. Can you write a procedure that picks up any error and deals with it no matter where it happens in the database?...
6
8438
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order...
2
3003
by: Steve Jorgensen | last post by:
When writing VB or VBA code that works with databases or other external libraries that cannot be trusted to automatically do the right thing when references to their objects are arbitrarily...
13
4434
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently...
21
4372
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So...
1
2241
by: pob | last post by:
>From a form I have some code that calls 4 modules frmMain 1 mod 2 mod 3 mod 4 mod If mod 1 experiences an error the error handling works fine within mod 1 and writes out the error to a...
0
11554
by: Lysander | last post by:
Thought I would give something back with a few articles. This article is a bit of code to add error handling. When I have time, I want to write articles on multilingual databases, and Access...
0
7252
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5676
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.