Handler class for the MOAssertions macros and functions.
An instance of MOAssertionHandler is used to implement policy for handling assertion failures. A single shared instance is created when needed, or an instance can be set to be used as the shared instance. The default instance created is directly of the class MOAssertionHandler, but subclasses can be created and instances of them used to alter the default handling policies. The default policy for an assertion failure is to log a message about it and then raise an exception.
currentHandler |
+ ( MOAssertionHandler *) currentHandler;
Returns the current assertion handler. If no assertion handler has been set using +setCurrentHandler: then this method will create an instance of MOAssertionHandler to use as the current handler and return it.
handleFailureWithRaise:inFunction:file:lineNumber:description: |
- ( void ) handleFailureWithRaise: (BOOL ) raise inFunction: (NSString *) functionName file: (NSString *) fileName lineNumber: (int ) line description: (NSString *) format, . . . ;
Varargs convenience method for assertions from function bodies. This simply does the varargs magic and calls -handleFailureInFunction:file:lineNumber:description:arguments:.
- raise
- Whether to actually raise an exception or just log an error.
- functionName
- The name of the function the assertion came from.
- fileName
- The source file name containing the function the assertion came from.
- line
- The line number from the source file where the assertion came from.
- format
- A +stringWithFormat: style format string giving the message of the assertion. The rest of the arguments are replacement arguments for the format string.
handleFailureWithRaise:inFunction:file:lineNumber:description:... |
- ( void ) handleFailureWithRaise: (BOOL ) raise inFunction: (NSString *) functionName file: (NSString *) fileName lineNumber: (int ) line description: (NSString *) format, . . . ;
Varargs convenience method for assertions from function bodies. This simply does the varargs magic and calls -handleFailureInFunction:file:lineNumber:description:arguments:.
- raise
- Whether to actually raise an exception or just log an error.
- functionName
- The name of the function the assertion came from.
- fileName
- The source file name containing the function the assertion came from.
- line
- The line number from the source file where the assertion came from.
- format
- A +stringWithFormat: style format string giving the message of the assertion. The rest of the arguments are replacement arguments for the format string.
handleFailureWithRaise:inFunction:file:lineNumber:description:arguments: |
- ( void ) handleFailureWithRaise: (BOOL ) raise inFunction: (NSString *) functionName file: (NSString *) fileName lineNumber: (int ) line description: (NSString *) format arguments: (va_list ) args;
This method is the primitive funnel for assertions from function bodies. This is the handler method that ultimately gets called when an assertion fails within a C function body (or a C++ method). Subclasses wishing to implement a new policy for handling assertion failures should override this method and also -handleFailureInMethod:object:file:lineNumber:description:arguments:.
- raise
- Whether to actually raise an exception or just log an error.
- functionName
- The name of the function the assertion came from.
- fileName
- The source file name containing the function the assertion came from.
- line
- The line number from the source file where the assertion came from.
- format
- A +stringWithFormat: style format string giving the message of the assertion.
- args
- The varargs list of replacement arguments for the format string.
handleFailureWithRaise:inMethod:object:file:lineNumber:description: |
- ( void ) handleFailureWithRaise: (BOOL ) raise inMethod: (SEL ) selector object: (id ) object file: (NSString *) fileName lineNumber: (int ) line description: (NSString *) format, . . . ;
Varargs convenience method for assertions from method bodies. This simply does the varargs magic and calls -handleFailureInMethod:object:file:lineNumber:description:arguments:.
- raise
- Whether to actually raise an exception or just log an error.
- selector
- The selector of the method the assertion came from.
- object
- The receiving object of the method the assertion came from.
- fileName
- The source file name containing the method the assertion came from.
- line
- The line number from the source file where the assertion came from.
- format
- A +stringWithFormat: style format string giving the message of the assertion. The rest of the arguments are replacement arguments for the format string.
handleFailureWithRaise:inMethod:object:file:lineNumber:description:... |
- ( void ) handleFailureWithRaise: (BOOL ) raise inMethod: (SEL ) selector object: (id ) object file: (NSString *) fileName lineNumber: (int ) line description: (NSString *) format, . . . ;
Varargs convenience method for assertions from method bodies. This simply does the varargs magic and calls -handleFailureInMethod:object:file:lineNumber:description:arguments:.
- raise
- Whether to actually raise an exception or just log an error.
- selector
- The selector of the method the assertion came from.
- object
- The receiving object of the method the assertion came from.
- fileName
- The source file name containing the method the assertion came from.
- line
- The line number from the source file where the assertion came from.
- format
- A +stringWithFormat: style format string giving the message of the assertion. The rest of the arguments are replacement arguments for the format string.
handleFailureWithRaise:inMethod:object:file:lineNumber:description:arguments: |
- ( void ) handleFailureWithRaise: (BOOL ) raise inMethod: (SEL ) selector object: (id ) object file: (NSString *) fileName lineNumber: (int ) line description: (NSString *) format arguments: (va_list ) args;
This method is the primitive funnel for assertions from method bodies. This is the handler method that ultimately gets called when an assertion fails within an Objective-C method body. Subclasses wishing to implement a new policy for handling assertion failures should override this method and also -handleFailureInFunction:file:lineNumber:description:arguments:.
- raise
- Whether to actually raise an exception or just log an error.
- selector
- The selector of the method the assertion came from.
- object
- The receiving object of the method the assertion came from.
- fileName
- The source file name containing the method the assertion came from.
- line
- The line number from the source file where the assertion came from.
- format
- A +stringWithFormat: style format string giving the message of the assertion.
- args
- The varargs list of replacement arguments for the format string.
setCurrentHandler: |
+ ( void ) setCurrentHandler: (MOAssertionHandler *) handler;
Sets the current assertion handler. If there was a previous handler it is released and the new one takes its place.
- handler
- The new assertion handler.
(Last Updated 3/20/2005)