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:
CaS 2004-06-05 06:17:10 +00:00
parent adcb9c12d5
commit 52a082959c
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> 2004-06-03 David Ayers <d.ayers@inode.at>
* Source/Additions/GSObjCRuntime.m (BDBGPrintf) New macro. * Source/Additions/GSObjCRuntime.m (BDBGPrintf) New macro.

View file

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