API 0.9.5
CPException Class Reference

Used to implement exception handling (creating & raising). More...

#import <CPException.h>

Inheritance diagram for CPException:

List of all members.

Instance Methods

(id) - copy
(CPString- description
(void) - encodeWithCoder:
(id) - initWithCoder:
(id) - initWithName:reason:userInfo:
(BOOL) - isEqual:
(CPString- name
(void) - raise
(CPString- reason
(CPDictionary- userInfo

Class Methods

(id) + alloc
(CPException+ exceptionWithName:reason:userInfo:
(void) + raise:reason:

Detailed Description

Used to implement exception handling (creating & raising).

An example of throwing an exception in Objective-J:

// some code here...
if (input == nil)
    [CPException raise:"MyException" reason:"You didn't do something right."];
// code that gets executed if no exception was raised

Definition at line 2 of file CPException.h.


Method Documentation

+ (id) alloc

Definition at line 51 of file CPException.j.

- (id) copy

Definition at line 156 of file CPException.j.

- (CPString) description

Returns the exception's reason.

Definition at line 128 of file CPException.j.

- (void) encodeWithCoder: (CPCoder aCoder

Encodes the exception's data into a coder.

Parameters:
aCoderthe coder to which the data will be written

Definition at line 190 of file CPException.j.

+ (CPException) exceptionWithName: (CPString aName
reason: (CPString aReason
userInfo: (CPDictionary aUserInfo 

Creates an exception with a name, reason and user info.

Parameters:
aNamethe name of the exception
aReasonthe reason the exception occurred
aUserInfoa dictionary containing information about the exception
Returns:
the new exception

Definition at line 75 of file CPException.j.

- (id) initWithCoder: (CPCoder aCoder

Initializes the exception with data from a coder.

Parameters:
aCoderthe coder from which to read the exception data
Returns:
the initialized exception

Definition at line 174 of file CPException.j.

- (id) initWithName: (CPString aName
reason: (CPString aReason
userInfo: (CPDictionary aUserInfo 

Initializes the exception.

Parameters:
aNamethe name of the exception
aReasonthe reason for the exception
aUserInfoa dictionary containing information about the exception
Returns:
the initialized exception

Definition at line 87 of file CPException.j.

- (BOOL) isEqual: (id)  anObject

Definition at line 141 of file CPException.j.

- (CPString) name

Returns the name of the exception.

Definition at line 104 of file CPException.j.

- (void) raise

Raises the exception and causes the program to go to the exception handler.

Definition at line 136 of file CPException.j.

+ (void) raise: (CPString aName
reason: (CPString aReason 

Raises an exception with a name and reason.

Parameters:
aNamethe name of the exception to raise
aReasonthe reason for the exception

Definition at line 63 of file CPException.j.

- (CPString) reason

Returns the reason for the exception.

Definition at line 112 of file CPException.j.

- (CPDictionary) userInfo

Returns data containing info about the receiver.

Definition at line 120 of file CPException.j.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines