more helpful error message when missing APNS certs

(imported from commit e21dc627844b9e28f93a924097176481d4135947)
This commit is contained in:
acrefoot 2013-11-26 14:32:59 -05:00
parent 8ee7536012
commit 8800dcdce4
1 changed files with 2 additions and 0 deletions

View File

@ -32,6 +32,8 @@ def hex_to_b64(data):
# mobile app # mobile app
@statsd_increment("apple_push_notification") @statsd_increment("apple_push_notification")
def send_apple_push_notification(user, alert, **extra_data): def send_apple_push_notification(user, alert, **extra_data):
if not connection:
logging.error("Attempting to send push notification, but no connection was found. This may be because we could not find the APNS Certificate file.")
# Sends a push notifications to all the PushClients # Sends a push notifications to all the PushClients
# Only Apple Push Notifications clients are supported at the moment # Only Apple Push Notifications clients are supported at the moment
tokens = [b64_to_hex(device.token) for device in AppleDeviceToken.objects.filter(user=user)] tokens = [b64_to_hex(device.token) for device in AppleDeviceToken.objects.filter(user=user)]