More code path test coverage

Added test coverage for untested code paths (mostly error handling) revealed by 'go tool cover'.
This function isn't used any more AFAICS.