When an error occurs while loading a plug-in, log it. Bug found by the analyzer.
authorPeter Hosey <hg@boredzo.org>
Sat Sep 26 17:36:21 2009 -0700 (2009-09-26)
changeset 4442e6763de09830
parent 4441 e4bc764cf865
child 4443 dd587a08f52b
When an error occurs while loading a plug-in, log it. Bug found by the analyzer.
Core/Source/GrowlPluginController.m
     1.1 --- a/Core/Source/GrowlPluginController.m	Sat Sep 26 17:36:20 2009 -0700
     1.2 +++ b/Core/Source/GrowlPluginController.m	Sat Sep 26 17:36:21 2009 -0700
     1.3 @@ -771,13 +771,19 @@
     1.4  	id <GrowlPluginHandler> handler;
     1.5  	while ((handler = [handlersEnum nextObject])) {
     1.6  		BOOL success = NO;
     1.7 -		if (pluginBundle && [handler respondsToSelector:@selector(loadPluginWithBundle:)])
     1.8 +		if (pluginBundle && [handler respondsToSelector:@selector(loadPluginWithBundle:)]) {
     1.9  			success = (NSUInteger)[handler performSelector:@selector(loadPluginWithBundle:) withObject:pluginBundle];
    1.10 -		else if ([handler respondsToSelector:@selector(loadPluginAtPath:)])
    1.11 +			if (!success)
    1.12 +				NSLog(@"%@: Handler %@ could not load plug-in with bundle %@", [self class], handler, pluginBundle);
    1.13 +		} else if ([handler respondsToSelector:@selector(loadPluginAtPath:)]) {
    1.14  			success = (NSUInteger)[handler performSelector:@selector(loadPluginAtPath:) withObject:path];
    1.15 -		else if ([handler respondsToSelector:@selector(loadPluginAtURL:)])
    1.16 +			if (!success)
    1.17 +				NSLog(@"%@: Handler %@ could not load plug-in at path %@", [self class], handler, path);
    1.18 +		} else if ([handler respondsToSelector:@selector(loadPluginAtURL:)]) {
    1.19  			success = (NSUInteger)[handler performSelector:@selector(loadPluginAtURL:) withObject:[NSURL fileURLWithPath:path]];
    1.20 -		else
    1.21 +			if (!success)
    1.22 +				NSLog(@"%@: Handler %@ could not load plug-in at URL for path %@", [self class], handler, path);
    1.23 +		} else
    1.24  			NSLog(@"warning: while loading plug-in at %@, tried to use plug-in handler %@, but it appears incapable of handling a plug-in", path, handler); //XXX should do this diagnostic when adding the handler
    1.25  	}
    1.26