result in the catch handler being caught.
"Joseph M. Newcomer" <newcomer@flounder.com> skrev i meddelandet
Is Exception a known data type?
A CDataSource might thrown a CException*, or something more specialized.
Note that CDataSource::Open says throw() which means it throws no
exceptions, so if it is
IS throwing an exception, the documentation is erroneous. Note also that
if the
documentation *is* correct, you are perhaps taking an access fault or
other weird
exception type which catch(...) will catch, but which are not legitimate
(see Doug
Harrison's essay on exceptions at http://members.cox.net/doug_web/eh.htm
There is no reason to explicitly include <exception> because this is an
MFC object and it
would throw a CException*. Microsoft habitually is vague about this,
somehow assuming you
will magically infer this knowledge, and even when they do mention it,
they usually get it
wrong (they will say "throws a memory exception" whatever that means, or
they will say
"Throws a CMemoryException" which is usually wrong; what both statements
mean to say is
"Throws a CMemoryException*", but the people who write the documentation
are clueless
about exceptions in general)
Try writing
catch(CException * ex)
and if you are not going to re-throw the exception, make sure you include
ex->Delete();
in your catch-handler (another piece of relatively-undocumented
folklore...)
joe
On Thu, 6 Nov 2008 15:46:12 +0100, "Tony Johansson"
<t.johansson@logica.com> wrote:
Hello!
DS is a CDataSource.
I tried to write catch(Exception ex)
but the compiler complains about the identifier Exception
I have also written #include <exception>
How should I write ?
//Tony
"markym" <no@email.com> wrote in message
news:uGwaBzBQJHA.2228@TK2MSFTNGP06.phx.gbl...
Tony Johansson wrote:
Hello!
This works but I want to get some information about the exception.
how do I modify this catch(...) to get additional information
It depends on the type of DS. We don't know it since
you did not tell us. Consult the documentation of the
Open() method of DS.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm