Article View: borland.public.cppbuilder.nativeapi
Article #6742Re: custom VCL exceptions, how?
From: Remy Lebeau (TeamB)
Date: Mon, 18 Apr 2005 19:42
Date: Mon, 18 Apr 2005 19:42
31 lines
1821 bytes
1821 bytes
"Francisco M. Marzoa" <fmmarzoa@softronica.org> wrote in message
news:4263d57c@newsgroups.borland.com...
> On Delphi/Kylix the way seems to be easier than in builder:
> just create a class that's a descendant of Exception like:
That is exactly what you do in C++ as well.
> I've try to do the same with Builder C++, but it didn't work.
That is because you are using it wrong. See below.
> I've created my exception as:
>
> class EDeviceNoAnswer : public Exception {};
That is not correct. You did not give your class a constructor, and the
Exception class does not have a default constructor available.
class EDeviceNoAnswer : public Exception
{
public:
__fastcall EDeviceNoAnswer(const AnsiString Msg) : Exception(Msg) {}
};
throw EDeviceNoAnswer("No answer sending Get Version command to
Device");
Gambit
Technical Details
Message-ID:
<42640d24@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!news.wiretrip.org!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4263d57c@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b4c3995c44850950 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4263d57c@newsgroups.borland.com> Subject: Re: custom VCL exceptions, how? Date: Mon, 18 Apr 2005 12:42:43 -0700 Lines: 33 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <42640d24@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1113853220 68.69.17.41 (18 Apr 2005 12:40:20 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!news.wiretrip.org!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail