Clean up API connect method and error handling

Hi there,

To appease the Code Climate gods I took a pass at cleaning up this connection method.  I rather like the pattern of using blocks for error handling because it keeps the focus on the happy execution path and it lets us reuse the error handling code.  Hutch needs to deal with a number of connection-related errors so it might be a good idea to have a more robust way of doing that.  If you like this way of doing things I can extend it to other methods that caught my eye.  Just wanted to check with you first.