Article View: borland.public.cppbuilder.nativeapi
Article #10683Re: exception "catch" clause
From: p Anders
Date: Thu, 25 Mar 2004 13:15
Date: Thu, 25 Mar 2004 13:15
71 lines
3125 bytes
3125 bytes
nevermind, I figured it out - had to remove the open and close parenthesis -
this leads to the next question:
I have several macros defined - some use the parenthesis and some don't -
when are these required and when not? Or maybe they're not required at
all??? Here's an example of where I use them, and below is an example of
when I shouldn't (I've removed the parenthesis that caused the original
message to have a problem).
#define AMF_REPORT_WARNING(message) ( \
AMF_AF_ErrorHandlerThreadC::NotifyUser ( \
AMF_AF_ExceptionC (AMF_AF_ExceptionC::ET_WARNING, \
message, __FILE__,,, __FUNC__, __LINE__)) )
Thanks again for the help!!
"p Anders" <paul.anderson@jhuapl.edu> wrote in message
news:4062cd03$1@newsgroups.borland.com...
> I'm trying to write a macro to use in place of a catch clause in order to
> save myself 18 lines of code wherever I need the catch clause. The macro
is
> defined as:
>
> #define AMF_BaseC_CATCH_EXCEPTION(Severity)
> \
> catch (AMF_AF_ExceptionC& amfException)
> \
>
>
{ \
> amfException.SetType(Severity);
> \
> sm_ErrorHandler->ReportException(amfException);
> \
> }
> \
> catch (runtime_error& e)
> \
>
>
{ \
> AMF_AF_ExceptionC amfException(e);
> \
> amfException.SetType(Severity);
> \
> sm_ErrorHandler->ReportException(amfException);
> \
> }
> \
> catch (...)
> \
>
>
{ \
> AMF_AF_ExceptionC amfException(Severity,
> \
> "Caught an unspecified
> AMF_AF_ExceptionC!", \
> __FILE__, m_tClassName.c_str(),
> __FUNC__); \
> sm_ErrorHandler->ReportException(amfException);
> \
> }
>
> I get a compoile error that says a "catch clause" was expected.
>
> Can I not use a macro here?
>
> Thanks.
>
>
Technical Details
Message-ID:
<4062db62$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4062cd03$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,d6b749007e0005d0 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-03-25 05:40:08 PST Reply-To: "p Anders" <paul.anderson@jhuapl.edu> From: "p Anders" <paul.anderson@jhuapl.edu> Newsgroups: borland.public.cppbuilder.nativeapi References: <4062cd03$1@newsgroups.borland.com> Subject: Re: exception "catch" clause Date: Thu, 25 Mar 2004 08:15:14 -0500 Lines: 73 Organization: JHU/APL X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 128.244.21.78 Message-ID: <4062db62$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1080220514 128.244.21.78 (25 Mar 2004 05:15:14 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail