Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > EOControl Reference

Table of Contents

NSException Additions


Category of: NSException
Declared in:
EOControl/EOClassDescription.h




Category Description


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 validateProperty: 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.




Class Methods



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];




Instance Methods



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.


Table of Contents