Gracefully handle more network errors.

I've had these changes sitting around for months.  I didn't commit them because
I thought they didn't work, which turns out was because I wasn't running a
version of the code that included them.  Derp.