home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: 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
-
-
- 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
-