def _on_error(self, device_token, error_msg, message):
        self._incr_memcached(TOTAL_ERRORS, 1)

        if error_msg == "MissingRegistration":
            logging.error('ERROR: GCM message sent without device token. This should not happen!')
    
        elif error_msg == "InvalidRegistration":
            self.delete_bad_token(device_token)
    
        elif error_msg == "MismatchSenderId":
            logging.error('ERROR: Device token is tied to a different sender id: ' + repr(device_token))
            self.delete_bad_token(device_token)
    
        elif error_msg == "NotRegistered":
            self.delete_bad_token(device_token)
    
        elif error_msg == "MessageTooBig":
            logging.error("ERROR: GCM message too big (max 4096 bytes).")
        
        elif error_msg == "InvalidTtl":
            logging.error("ERROR: GCM Time to Live field must be an integer representing a duration in seconds between 0 and 2,419,200 (4 weeks).")
        
        elif error_msg == "MessageTooBig":
            logging.error("ERROR: GCM message too big (max 4096 bytes).")
        
        elif error_msg == "Unavailable":
            retry_seconds = 10
            logging.error('ERROR: GCM Unavailable. Retry after delay. Requeuing message. Delay in seconds: ' + str(retry_seconds))
            retry_timestamp = datetime.now() + timedelta(seconds=retry_seconds)
            self._set_memcached(RETRY_AFTER, retry_timestamp)
            self._requeue_message(message)
        
        elif error_msg == "InternalServerError":
            logging.error("ERROR: Internal error in the GCM server while trying to send message: " + repr(message))
        
        else:
            logging.error("Unknown error: %s for device token: %s" % (repr(error_msg), repr(device_token)))
dataset/ETHPy150Open gregbayer/gae-python-gcm/gae_python_gcm/gcm.py/GCMConnection._on_error/original