Class CPException

CPObject
    extended byCPException

@implementation CPException : CPObject

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


Method Summary
+(CPException)exceptionWithName:(CPString)aName reason:(CPString)aReason userInfo:(CPDictionary)aUserInfo
          Creates an exception with a name, reason and user info.
+(void)raise:(CPString)aName reason:(CPString)aReason
          Raises an exception with a name and reason.
-(id)initWithCoder:(CPCoder)aCoder
          Initializes the exception with data from a coder.
-(id)initWithName:(CPString)aName reason:(CPString)aReason userInfo:(CPDictionary)aUserInfo
          Initializes the exception.
-(id)copy
          Makes a deep copy of the receiver.
-(CPString)description
          Returns the exception's reason.
-(void)encodeWithCoder:(CPCoder)aCoder
          Encodes the exception's data into a coder.
-(CPString)name
          Returns the name of the exception.
-(void)raise
          Raises the exception and causes the program to go to the exception handler.
-(CPString)reason
          Returns the reason for the exception.
-(CPDictionary)userInfo
          Returns data containing info about the receiver.

Methods inherited from class CPObject
initialize, alloc, class, instanceMethodForSelector, instancesRespondToSelector, isSubclassOfClass, load, new, setVersion, superclass, version, init, autorelease, awakeAfterUsingCoder, class, classForCoder, classForKeyedArchiver, className, copy, dealloc, description, doesNotRecognizeSelector, forwardInvocation, hash, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableCopy, performSelector, performSelector, performSelector, release, replacementObjectForArchiver, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, retain, self, superclass


Method Detail

exceptionWithName

+(CPException)exceptionWithName:(CPString)aName reason:(CPString)aReason userInfo:(CPDictionary)aUserInfo
Creates an exception with a name, reason and user info.
Parameters:
aName - the name of the exception
aReason - the reason the exception occurred
aUserInfo - a dictionary containing information about the exception
Returns:
the new exception

raise

+(void)raise:(CPString)aName reason:(CPString)aReason
Raises an exception with a name and reason.
Parameters:
aName - the name of the exception to raise
aReason - the reason for the exception

initWithCoder

-(id)initWithCoder:(CPCoder)aCoder
Initializes the exception with data from a coder.
Parameters:
aCoder - the coder from which to read the exception data
Returns:
the initialized exception

initWithName

-(id)initWithName:(CPString)aName reason:(CPString)aReason userInfo:(CPDictionary)aUserInfo
Initializes the exception.
Parameters:
aName - the name of the exception
aReason - the reason for the exception
aUserInfo - a dictionary containing information about the exception
Returns:
the initialized exception

copy

-(id)copy
Makes a deep copy of the receiver. The copy should be functionally equivalent to the receiver.
Returns:
the copy of the receiver

description

-(CPString)description
Returns the exception's reason.

encodeWithCoder

-(void)encodeWithCoder:(CPCoder)aCoder
Encodes the exception's data into a coder.
Parameters:
aCoder - the coder to which the data will be written

name

-(CPString)name
Returns the name of the exception.

raise

-(void)raise
Raises the exception and causes the program to go to the exception handler.

reason

-(CPString)reason
Returns the reason for the exception.

userInfo

-(CPDictionary)userInfo
Returns data containing info about the receiver.

Created on Sat Sep 13 14:15:43 PDT 2008