To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=83978
Issue #|83978
Summary|Basic runtime: unpack multiple WrappedTargetException
|errors, and error handling consolidation
Component|framework
Version|680m237
Platform|All
URL|
OS/Version|All
Status|NEW
Status whiteboard|
Keywords|
Resolution|
Issue type|PATCH
Priority|P3
Subcomponent|code
Assigned to|ab
Reported by|fs
------- Additional comments from [EMAIL PROTECTED] Mon Nov 26 14:18:41 +0000
2007 -------
Invoking, from within Basic, a method in a component of mine which throws a
WrappedTargetException, I found it somewhat unfortunate that the Basic IDE only
shows the message of the WrappedTargetException (which is of limited use to the
user, as it is often the case with "wrapping" exceptions), but not the message
of the exception which was actually wrapped.
Thus, I here propose a fix to the sbunoobj.cxx file, which actually unpacks a
"chain" of WrappedTargetExceptions. That is, if the
WrappedTargetException.TargetException member is a WrappedTargetException
itself, then it will also be handled, and so on.
For this, the patch modifies implHandleWrappedTargetException:
- first, if the exception is an InvocationTargetException, it is
completely ignored. Note that this is what the old code does with
completely ignoring any WrappedTargetException's message, silently
assuming that it is always an InvocationTargetException.
- then, the message of the WrappedTargetException is appended to a string
buffer.
- If the TargetException member of the error is also a WrappedTargetException,
it continues with the previous step.
- If there is no WrappedTargetException anymore, but TargetException
still contains an Exception object, this object's message is also
appended.
- The special handling for BasicErrorException instances was preserved:
"Traveling" the chain of WrappedTargetException's finishes if such
a BasicErrorException is encountered.
Also, while I changed the code, I noticed there's a lot of duplicate code in the
exception handling, basically multiple
catch ( FooException& e1 )
{
handleFooException( e1 );
}
catch( BarException& e2 )
{
handleBarException( e2 );
}
...
blocks. Since there today exists a "::cppu::getCaughtException()", I took the
liberty to consolidate those blocks into single
catch( const Exception& )
{
handleAnyException( ::cppu::getCaughtException() );
}
blocks.
In the same course, the
String implGetExceptionMsg( Exception& e )
was replaced with
template< class EXCEPTION >
String implGetExceptionMsg( const EXCEPTION& e )
, which means we now always display the type of the caught exception.
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]