diff --git a/ChangeLog b/ChangeLog index 69d8b57d2..1d6d37981 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * Source/NSObject.m: Implemented and documented -className * Tools/AGSOutput.m: When Verbose = YES log all documentable entities for which no comment text was found. + * Source/NSException.m: Added NSParseErrorException and tidied other + general exceptions. + * Source/extern.m: Removed generic exceptions ... now in NSException.m 2002-06-06 Adam Fedor diff --git a/Headers/gnustep/base/NSException.h b/Headers/gnustep/base/NSException.h index a5695f19d..1ee4aef4a 100644 --- a/Headers/gnustep/base/NSException.h +++ b/Headers/gnustep/base/NSException.h @@ -59,12 +59,15 @@ @end /* Common exceptions */ -GS_EXPORT NSString* const NSGenericException; -GS_EXPORT NSString* const NSInternalInconsistencyException; -GS_EXPORT NSString* const NSInvalidArgumentException; -GS_EXPORT NSString* const NSMallocException; -GS_EXPORT NSString* const NSRangeException; -GS_EXPORT NSString* const NSCharacterConversionException; +GS_EXPORT const NSString* const NSGenericException; +GS_EXPORT const NSString* const NSInternalInconsistencyException; +GS_EXPORT const NSString* const NSInvalidArgumentException; +GS_EXPORT const NSString* const NSMallocException; +GS_EXPORT const NSString* const NSRangeException; +GS_EXPORT const NSString* const NSCharacterConversionException; +#ifndef STRICT_OPENSTEP +GS_EXPORT const NSString* const NSParseErrorException; +#endif /* Exception handler definitions */ typedef struct _NSHandler diff --git a/Source/NSException.m b/Source/NSException.m index 7cef54bbf..745743e0a 100644 --- a/Source/NSException.m +++ b/Source/NSException.m @@ -34,6 +34,50 @@ #include #include +/** + * A generic exception for general purpose usage. + */ +const NSString* const NSGenericException + = @"NSGenericException"; + +/** + * An exception for caes where unexpected state is detected within an object + */ +const NSString* const NSInternalInconsistencyException + = @"NSInternalInconsistencyException"; + +/** + * An exception used when an invalid argument is passed to a method + * or function. + */ +const NSString* const NSInvalidArgumentException + = @"NSInvalidArgumentException"; + +/** + * An exception used when the system faols to allocate required memory. + */ +const NSString* const NSMallocException + = @"NSMallocException"; + +/** + * An exception used when an illegal range is encountered ... usually this + * is used to provide more information than an invalid argument exception. + */ +const NSString* const NSRangeException + = @"NSRangeException"; + +/** + * An exception when character set conversion fails. + */ +const NSString* const NSCharacterConversionException + = @"NSCharacterConversionException"; + +/** + * An exception used when some form of parsing fails. + */ +const NSString* const NSParseErrorException + = @"NSParseErrorException"; + #include "GSPrivate.h" static void diff --git a/Source/externs.m b/Source/externs.m index 8ad549b16..9e789dd7c 100644 --- a/Source/externs.m +++ b/Source/externs.m @@ -74,20 +74,6 @@ NSString *NSConnectionReplyMode; -/* Exceptions */ -NSString * const NSCharacterConversionException; - -NSString * const NSGenericException; - -NSString * const NSInternalInconsistencyException; - -NSString * const NSInvalidArgumentException; - -NSString * const NSMallocException; - -NSString * const NSRangeException; - - /* Exception handler */ NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler; @@ -299,9 +285,6 @@ GSBuildStrings() = [[SClass alloc] initWithCString: "NSArgumentDomain"]; NSBundleDidLoadNotification = [[SClass alloc] initWithCString: "NSBundleDidLoadNotification"]; - *(NSString**)&NSCharacterConversionException - = [[SClass alloc] initWithCString: - "NSCharacterConversionException"]; NSConnectionDidDieNotification = [[SClass alloc] initWithCString: "NSConnectionDidDieNotification"]; @@ -386,19 +369,12 @@ GSBuildStrings() = [[SClass alloc] initWithCString: "NSFileTypeUnknown"]; NSFormalName = [[SClass alloc] initWithCString: "NSFormalName"]; - *(NSString**)&NSGenericException - = [[SClass alloc] initWithCString: "NSGenericException"]; NSGlobalDomain = [[SClass alloc] initWithCString: "NSGlobalDomain"]; NSHourNameDesignations = [[SClass alloc] initWithCString: "NSHourNameDesignations"]; - *(NSString**)&NSInternalInconsistencyException - = [[SClass alloc] initWithCString: - "NSInternalInconsistencyException"]; NSInternationalCurrencyString = [[SClass alloc] initWithCString: "NSInternationalCurrencyString"]; - *(NSString**)&NSInvalidArgumentException - = [[SClass alloc] initWithCString: "NSInvalidArgumentException"]; NSLanguageCode = [[SClass alloc] initWithCString: "NSLanguageCode"]; NSLanguageName @@ -409,8 +385,6 @@ GSBuildStrings() = [[SClass alloc] initWithCString: "NSLoadedClasses"]; NSLocale = [[SClass alloc] initWithCString: "NSLocale"]; - *(NSString**)&NSMallocException - = [[SClass alloc] initWithCString: "NSMallocException"]; NSMonthNameArray = [[SClass alloc] initWithCString: "NSMonthNameArray"]; NSNegativeCurrencyFormatString @@ -428,8 +402,6 @@ GSBuildStrings() "NSPositiveCurrencyFormatString"]; NSPriorDayDesignations = [[SClass alloc] initWithCString: "NSPriorDayDesignations"]; - *(NSString**)&NSRangeException - = [[SClass alloc] initWithCString: "NSRangeException"]; NSRegistrationDomain = [[SClass alloc] initWithCString: "NSRegistrationDomain"]; NSShortDateFormatString