API  1.0.0
CPException Class Reference

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

#import <CPException.h>

+ Inheritance diagram for CPException:

Instance Methods

(id) - copy
 
(CPString- description
 
(void) - encodeWithCoder:
 
(id) - initWithCoder:
 
(id) - initWithName:reason:userInfo:
 
(BOOL) - isEqual:
 
(void) - raise
 
(CPString- reason
 
(CPDictionary- userInfo
 
- Instance Methods inherited from CPObject
(void) - addObserver:forKeyPath:options:context:
 
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - awakeFromCib
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(void) - dealloc
 
(CPDictionary- dictionaryWithValuesForKeys:
 
(void) - didChange:valuesAtIndexes:forKey:
 
(void) - didChangeValueForKey:
 
(void) - didChangeValueForKey:withSetMutation:usingObjects:
 
(void) - doesNotRecognizeSelector:
 
(CPArray) - exposedBindings
 
(id) - forwardingTargetForSelector:
 
(void) - forwardInvocation:
 
(unsigned) - hash
 
(BOOL) - implementsSelector:
 
(CPDictionary- infoForBinding:
 
(id) - init
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(IMP) - methodForSelector:
 
(CPMethodSignature) - methodSignatureForSelector:
 
(id) - mutableArrayValueForKey:
 
(id) - mutableArrayValueForKeyPath:
 
(id) - mutableCopy
 
(id) - mutableSetValueForKey:
 
(id) - mutableSetValueForKeyPath:
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(void) - performSelector:withObject:afterDelay:
 
(void) - performSelector:withObject:afterDelay:inModes:
 
(id) - performSelector:withObject:withObject:
 
(id) - performSelector:withObjects:
 
(void) - release
 
(void) - removeObserver:forKeyPath:
 
(id) - replacementObjectForArchiver:
 
(id) - replacementObjectForCoder:
 
(id) - replacementObjectForKeyedArchiver:
 
(BOOL) - respondsToSelector:
 
(id) - retain
 
(id) - self
 
(void) - setValue:forKey:
 
(void) - setValue:forKeyPath:
 
(void) - setValue:forUndefinedKey:
 
(void) - setValuesForKeysWithDictionary:
 
(CPString- UID
 
(void) - unbind:
 
(Class) - valueClassForBinding:
 
(id) - valueForKey:
 
(id) - valueForKeyPath:
 
(id) - valueForUndefinedKey:
 
(void) - willChange:valuesAtIndexes:forKey:
 
(void) - willChangeValueForKey:
 
(void) - willChangeValueForKey:withSetMutation:usingObjects:
 

Class Methods

(id) + alloc
 
(CPException+ exceptionWithName:reason:userInfo:
 
(void) + raise:format:
 
(void) + raise:reason:
 
- Class Methods inherited from CPObject
(BOOL) + accessInstanceVariablesDirectly
 
(id) + allocWithCoder:
 
(BOOL) + automaticallyNotifiesObserversForKey:
 
(void) + cancelPreviousPerformRequestsWithTarget:
 
(void) + cancelPreviousPerformRequestsWithTarget:selector:object:
 
(Class) + class
 
(BOOL) + conformsToProtocol:
 
(void) + exposeBinding:
 
(void) + initialize
 
(IMP) + instanceMethodForSelector:
 
(BOOL) + instancesImplementSelector:
 
(BOOL) + instancesRespondToSelector:
 
(BOOL) + isBindingExclusive:
 
(BOOL) + isSubclassOfClass:
 
(CPSet) + keyPathsForValuesAffectingValueForKey:
 
(void) + load
 
(id) + new
 
(void) + object:performSelector:withObject:afterDelay:inModes:
 
(void) + setVersion:
 
(Class) + superclass
 
(int) + version
 

Instance Variables

CPString message
 
CPString name
 

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

◆ alloc()

+ (id) alloc
implementation

Allocates a new instance of the receiving class

Reimplemented from CPObject.

Definition at line 54 of file CPException.j.

◆ copy()

- (id) copy
implementation

Makes a deep copy of the receiver. The copy should be functionally equivalent to the receiver.

Returns
the copy of the receiver

Reimplemented from CPObject.

Provided by category CPException(CPCopying).

Definition at line 175 of file CPException.j.

◆ description()

- (CPString) description
implementation

Returns the exception's reason.

Reimplemented from CPObject.

Definition at line 147 of file CPException.j.

◆ encodeWithCoder:()

- (void) encodeWithCoder: (CPCoder aCoder
implementation

Encodes the exception's data into a coder.

Parameters
aCoderthe coder to which the data will be written

Provided by category CPException(CPCoding).

Definition at line 209 of file CPException.j.

◆ exceptionWithName:reason:userInfo:()

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

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 94 of file CPException.j.

◆ initWithCoder:()

- (id) initWithCoder: (CPCoder aCoder
implementation

Initializes the exception with data from a coder.

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

Provided by category CPException(CPCoding).

Definition at line 193 of file CPException.j.

◆ initWithName:reason:userInfo:()

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

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 106 of file CPException.j.

◆ isEqual:()

- (BOOL) isEqual: (id)  anObject
implementation

Determines if anObject is functionally equivalent to the receiver.

Returns
YES if anObject is functionally equivalent to the receiver.

Reimplemented from CPObject.

Definition at line 160 of file CPException.j.

◆ raise()

- (void) raise
implementation

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

Definition at line 155 of file CPException.j.

◆ raise:format:()

+ (void) raise: (CPString aName
format: (CPString aFormat
,   ... 
implementation

Raises an exception with a name and a formatted reason.

Parameters
aNamethe name of the exception to raise
aFormatthe reason for the exception in sprintf style
...the arguments for the sprintf format

Definition at line 77 of file CPException.j.

◆ raise:reason:()

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

Raises an exception with a name and reason.

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

Definition at line 66 of file CPException.j.

◆ reason()

- (CPString) reason
implementation

Returns the reason for the exception.

Definition at line 131 of file CPException.j.

◆ userInfo()

- (CPDictionary) userInfo
implementation

Returns data containing info about the receiver.

Definition at line 139 of file CPException.j.

Instance Variable Documentation

◆ message

- (CPString) message
protected

Definition at line 6 of file CPException.h.

◆ name

- (CPString) name
protected

Returns the name of the exception.

Definition at line 5 of file CPException.h.


The documentation for this class was generated from the following files: