Clean up API connect method and error handling
Merge pull request #67 from desmondmonster/broker_error_handling

Clean up API connect method and error handling