Be more specific about the exceptions being caught

In the case of main.py, we get different exceptions in differnt
places under nosetests hence the double listing.

Change-Id: I54c89fa953ce4728dcae7a9ea72b46b54e7ebe0d