Changes

Jump to: navigation, search

Obj-C Exceptions In Gecko

18 bytes added, 18:05, 14 February 2008
no edit summary
* For wrapping calls that are not expressions, do not return values (at least not ones we care about)
** <code>NS_OBJC_TRY_IGNORE();</code>** <code>NS_OBJC_TRY_ABORT();</code>
* For wrapping expressions that return a value
** <code>NS_OBJC_TRY_EXPR_NULL();</code>** <code>NS_OBJC_TRY_EXPR_ABORT();</code>
An example of non-EXPR macro usage:
* Basic wrapping, use anywhere
** <code>NS_OBJC_BEGIN_TRY_ABORT_BLOCK;</code>** <code>NS_OBJC_END_TRY_ABORT_BLOCK;</code>
* Use to wrap an entire method that returns an Obj-C pointer
** <code>NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;</code>** <code>NS_OBJC_END_TRY_ABORT_BLOCK_NIL;</code>
* Used to wrap an entire method that returns an xpcom result code (<code>nsresult</code>)
** <code>NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;</code>** <code>NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;</code>
We will probably add another block type that returns nsnull, for use with methods that return xpcom objects, we might add others as the need arises. For any other place where you would like to wrap an entire method, you'll have to use the first basic block macros and refactor code to correctly to place the return statement after the end macro. This means you'll also have to scope any variables used in the return statement correctly.
Confirm, emeritus
1,680
edits

Navigation menu