Article View: borland.public.cppbuilder.nativeapi
Article #6733custom VCL exceptions, how?
From: Francisco M. Marzoa
Date: Mon, 18 Apr 2005 15:42
Date: Mon, 18 Apr 2005 15:42
42 lines
1998 bytes
1998 bytes
Hi,
I'm trying to create my own Exceptions to raise them when needed, but
I've found some difficulties and I've not been able still :-(
On Delphi/Kylix the way seems to be easier than in builder: just create
a class that's a descendant of Exception like:
EDeviceNoAnswer = class ( Exception );
And when you need to raise it, just do:
raise EDeviceNoAnswer.Create ( 'No answer sending Get Version command to
Device' );
I've try to do the same with Builder C++, but it didn't work.
I've created my exception as:
class EDeviceNoAnswer : public Exception {};
And then I try to raise it in different manners, with different errors
at compile time, i.e.:
throw EDeviceNoAnswer.Create ();
or just
throw EDeviceNoAnswer;
Says:
E2108 Improper use of typedef 'EDeviceNoAnswer'
throw new EDeviceNoAnswer();
Says:
E2125 Compiler could not generate default constructor for class
'EDeviceNoAnswer'
And so on... Someone can help me? Thanks a lot in advance.
Technical Details
Message-ID:
<4263d57c@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b4c3995c44850950,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 18 Apr 2005 17:42:53 +0200 From: "Francisco M. Marzoa" <fmmarzoa@softronica.org> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: custom VCL exceptions, how? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 213.4.20.55 Message-ID: <4263d57c@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1113838972 213.4.20.55 (18 Apr 2005 08:42:52 -0800) Lines: 43 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail