Article View: comp.os.ms-windows.programmer.misc
Article #2075Need error handling ideas
From: Steven Alexander
Date: Mon, 16 Nov 1992 21:35
Date: Mon, 16 Nov 1992 21:35
61 lines
1977 bytes
1977 bytes
Please reply to email address:
sun!kla!anil OR kla!anil@sun.com
I am curious what kind of mechanisms other people have
devised to handle errors and aid debugging of their
applications in C++ and Windows. I am NOT talking about
full blown exception handling.
Just simple things like failure of 'new' or file open.
What I am using now is nested conditional constructs.
e.g.
In a constructor for a dialog box with 3 buttons and 1
static text,
{
button1 = new TButton( ... );
if (button1) {
button2 = new TButton( ... );
if (button2) {
button3 = new TButton( ... );
if (button3) {
label = new TStatic( ... );
if (label) {
// SUCCESS
} else {
// label failed
MessageBox( ... );
}
else {
// Button3 failed
MessageBox( ... );
}
else {
// Button2 failed
MessageBox( ... );
}
else {
// Button1 failed
MessageBox( ... );
}
}
As you see, this gets messy as the number of components increase.
Also, this does not provide the user, retry, cancel or ignore
options.
Are there any class libraries out there to facilitate this kind
of error handling? Are there mechanisms inherent in C++ or Windows?
Overloading of new in the above case looks like a probable solution?
Send me your replies and should there be sufficient interest I will
summarize and post.
Thanks.
Anil sun!kla!anil OR kla!anil@sun.com
Technical Details
Message-ID:
<1992Nov16.213552.27428@leland.Stanford.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!ukma!wupost!spool.mu.edu!agate!stanford.edu!leland.Stanford.EDU!bumblesShow Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!wupost!spool.mu.edu!agate!stanford.edu!leland.Stanford.EDU!bumbles From: bumbles@leland.Stanford.EDU (Steven Alexander) Subject: Need error handling ideas Message-ID: <1992Nov16.213552.27428@leland.Stanford.EDU> Sender: news@leland.Stanford.EDU (Mr News) Organization: DSG, Stanford University, CA 94305, USA Date: Mon, 16 Nov 92 21:35:52 GMT Lines: 61