Hello everyone,
I guess this question appears time-to-time, but missed it:
Why do I loose meaningful error info if following macro (placed in the
catch-block) used to "throw-or-forward" exception?
#define IssueATLError( _e ) \
{ \
ATLTRACE( "\nThread: %p, File: %s, line: %d\n", GetCurrentThreadId(),
__FILE__, __LINE__ ); \
CComBSTREx bstrErrText; \
bstrErrText.Format( IDS_ERROR, \
(LPCOLESTR)_e.ErrorMessage(), \
(LPCOLESTR)_e.Description(), \
(LPCOLESTR)_e.Source()); \
ATLTRACE( bstrErrText ); \
return Error( bstrErrText, _e.GUID(), _e.Error() ); \
}
like that:
try
{
ISomeObjectPtr spSomeObject( __uuidof(SomeObject));
spSomeObject->CallSomethingThrowingException(); // throws exception using
above mentioned macro (supposenly returning something informative, like "no
current record")
Quote:
}
catch(_com_error& e)
{
AtlIssueError( e ); // try to "forward" exception further
Quote:
}
will not produce meaningful error. only correct HR will be returned with
description and source totaly lost - "Description: (null), Source: (null)"
I guess, some interface at the moment when final client gets chance to
process the exception already released or something?
Thanks in advance,
Eugene.