Make exceptions a bit more informative.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19460 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-06-05 06:17:10 +00:00
parent f554633dce
commit a4b37594c5
2 changed files with 20 additions and 5 deletions

View file

@ -1,3 +1,7 @@
2004-06-05 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSDictionary.m: Make exceptions a little more informative.
2004-06-03 David Ayers <d.ayers@inode.at>
* Source/Additions/GSObjCRuntime.m (BDBGPrintf) New macro.

View file

@ -377,13 +377,24 @@ static SEL objSel;
if (aKey == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"Tried to add nil key to dictionary"];
NSException *e;
e = [NSException exceptionWithName: NSInvalidArgumentException
reason: @"Tried to add nil key to dictionary"
userInfo: self];
[e raise];
}
if (anObject == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"Tried to add nil value to dictionary"];
NSException *e;
NSString *s;
s = [NSString stringWithFormat:
@"Tried to add nil value for key '%@' to dictionary", aKey];
e = [NSException exceptionWithName: NSInvalidArgumentException
reason: s
userInfo: self];
[e raise];
}
node = GSIMapNodeForKey(&map, (GSIMapKey)aKey);
if (node)
@ -407,7 +418,7 @@ static SEL objSel;
{
if (aKey == nil)
{
NSWarnMLog(@"attempt to remove nil key");
NSWarnMLog(@"attempt to remove nil key from dictionary %@", self);
return;
}
GSIMapRemoveKey(&map, (GSIMapKey)aKey);