Swap the URLError and HTTPError exception handlers. HTTPError is a subclass of URLError, so the HTTPError handler wasn't being reached. Change-Id: Iec86d2b345dbd37858af888bbd54a74884025eda