Be more resilent around import/detection/setup errors

It appears that some of our current testr failures
are due to this module not handling exception cases
very well; this is making it hard to debug and hard
to determine what the errors are, so handle more of
the general exceptions better in more of the places
where they are problematic.

Change-Id: I7c71d3a68852c0093f27f3b16d6475cc0a8bf8ef