Raise exceptions

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11357 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2001-11-10 03:53:33 +00:00
parent 65b1b6a8df
commit 810fc6f2c7
2 changed files with 23 additions and 7 deletions

View file

@ -1,3 +1,10 @@
2001-11-09 Adam Fedor <fedor@gnu.org>
* Source/NSView.m (-addSubview:): Raise exception on adding nil
subview or superview of view.
(-addSubview:positioned:relativeTo:): Likewise.
(-beginDocument): Change NSLog to exception.
Thu Nov 8 23:30:47 2001 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSMatrix.m ([-sizeToFit]): Reverted last change.

View file

@ -285,10 +285,15 @@ GSSetDragTypes(NSView* obj, NSArray *types)
- (void) addSubview: (NSView*)aView
{
if (aView == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"Adding a nil subview"];
}
if ([self isDescendantOf: aView])
{
NSLog(@"Operation addSubview: creates a loop in the views tree!\n");
return;
[NSException raise: NSInvalidArgumentException
format: @"addSubview: creates a loop in the views tree!\n"];
}
RETAIN(aView);
@ -313,11 +318,15 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{
unsigned index;
if (aView == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"Adding a nil subview"];
}
if ([self isDescendantOf: aView])
{
NSLog(@"addSubview: positioned: relativeTo: will create a cycle "
@"in the views tree!\n");
return;
[NSException raise: NSInvalidArgumentException
format: @"addSubview: positioned: relativeTo: creates a loop in the views tree!\n"];
}
if (aView == otherView)
@ -2852,8 +2861,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
dict = [[printOp printInfo] dictionary];
if (printOp == nil)
{
NSLog(@"[NSView -beginDocument] called without a current print op");
return;
[NSException raise: NSInternalInconsistencyException
format: @"beginDocument called without a current print op"];
}
/* Inform ourselves and subviews that we're printing so we adjust
the PostScript accordingly. Perhaps this could be in the thread