Added fancier error handling for the APNS client