Handle connection errors

/to @ritch