www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/19/01:01:16

X-Originating-Host: 63.21.240.15
Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here
Subject: Exception Handling
Lines: 44
From: Dogansmoobs <dogansmoobsNOdoSPAM AT hotmail DOT com DOT invalid>
Newsgroups: comp.os.msdos.djgpp
Message-ID: <0519f96f.5fb31bd3@usw-ex0104-033.remarq.com>
Bytes: 1037
X-Wren-Trace: eHJXf35nIGohNml9djxgdm9uYGRXfj1wen90fTVlZD89ImE9LmMpLiojOCYp
Date: Tue, 18 Jul 2000 13:37:24 -0700
NNTP-Posting-Host: 10.0.2.33
X-Complaints-To: wrenabuse AT remarq DOT com
X-Trace: WReNphoon3 963953496 10.0.2.33 (Tue, 18 Jul 2000 13:51:36 PDT)
NNTP-Posting-Date: Tue, 18 Jul 2000 13:51:36 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am having a problem with exception handling.  Whenever I try
to cathch and exception, instead of running what's in the catch
block, it exits the program and displays Abort!!.  Is there
something I'm missing, or doing wrong??  Here's what I'm doing:

#include <iosteam>

class exception
{
 public:
   exception(char *message)
   {
    strcpy(errorMessage, message);
   }

   void display()
   {
    cout << errorMessage;
   }

 private:
   char *errorMessage;
};

Then whin I want to throw an exception, I say:
   throw exception("Error message here");

and then catch it using:
   catch (exception &e)

but it never does this, it just aborts.  And yes, the code that
produces the exception is in a try block.

 - Dogansmoobs
http://wookie.freehosting.net/
I would call myself Duncan Blownuts, but people might think I'm
insane.


-----------------------------------------------------------

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019