Documentation Archive Developer
Search
PATH  WebObjects 4.0 Documentation > EOControl Reference



NSException Additions

Inherits From:
NSObject

Declared in: EOControl/EOClassDescription.h

Enterprise Objects Framework adds methods to the Foundation Framework's NSException class for handling validating errors and augmenting an exception's userInfo dictionary. The methods used for validation errors are validationExceptionWithFormat: and aggregateExceptionWithExceptions: . You use validationExceptionWithFormat: in an enterprise object's validateFor... or validate Property: method, as described in the NSObject Additions class specification. The other method used for validation errors, aggregateExceptionWithExceptions: , is used internally by the Framework to group multiple validation exceptions together.

The method exceptionAddingEntriesToUserInfo: is used to augment an exception's userInfo dictionary.

Creating a validation exception
+ validationExceptionWithFormat:
Collecting exceptions
+ aggregateExceptionWithExceptions:
Returning an exception with an augmented userInfo dictionary
- exceptionAddingEntriesToUserInfo:


aggregateExceptionWithExceptions:

+ (NSException *)aggregateExceptionWithExceptions:(NSArray *)subexceptions

Returns an NSException with the same name, reason, and userInfo dictionary of the first exception in the subexceptions array, but with the userInfo dictionary augmented with the list of subexceptions under the key EOAdditionalExceptionsKey.

See also: - exceptionAddingEntriesToUserInfo:


validationExceptionWithFormat:

+ (NSException *)validationExceptionWithFormat: (NSString *)format, ...

Returns an NSException whose name is EOValidationException and whose reason is an NSString created from format and subsequent arguments. For example:

[NSException validationExceptionWithFormat:@"invalid name \"%@\": entity names cannot be 
nil or empty", name];


exceptionAddingEntriesToUserInfo:

- (NSException *)exceptionAddingEntriesToUserInfo:(NSDictionary *)additions

Returns an NSException whose userInfo dictionary has been augmented with the object and property information contained in additions. When exceptions are raised by certain validation methods such as validateValue:forKey:, this message is sent to the exception to create a duplicate exception with object and property information added to the new exception's userInfo dictionary. This information is stored in the userInfo dictionary under the keys EOValidatedObjectUserInfoKey and EOValidatedPropertyUserInfoKey, respectively. The exception that's returned by this method has the same class with the same name and reason as the original exception; the only difference is the augmented userInfo dictionary.





Copyright © 1998, Apple Computer, Inc. All rights reserved.