Declared in NSException+GBException.h
NSException+GBException.m

Overview

Adds helper methods to NSException for more organized code.

Tasks

Class Methods

raise:

Raises the exception with the given format.

+ (void)raise:(NSString *)format

Parameters

format
A human readable message string representing exception reason.
...
A comma separated list of arguments to substitute into the format.

Discussion

This is a shortcut for raise:format: method and makes exception creation code much less verbose. As we don't use specialized exception names, this makes sense...

Exceptions

NSException
Always thrown ;)

Declared In

NSException+GBException.h

raise:format:

Raises the exception with the given NSError object.

+ (void)raise:(NSError *)error format:(NSString *)format

Parameters

error
The error that describes the reason.
format
A human readable message string explaining the context of the error.
...
A comma separated list of arguments to substitute into the format.

Discussion

This is useful for converting NSErrors into NSExceptions. The method allows the client to pass in additional context information which further aids diagnosting the exact reason for the exception. If no context information is desired, pass nil and only error information is used for formatting. As exception message can become quite verbose, it is split into several lines to make the output more readable.

Exceptions

NSException
Always thrown ;)

Declared In

NSException+GBException.h