supports error response from gateway server

Apple gateway server sometime returns error.
I added reading that response and raise error.
This fix allows users of this library to retry.