/// <summary> /// Handles a failed notification and returns the result for the failure or null if the exception should be rethrown. /// </summary> /// <param name="notification">The notification that failed to send.</param> /// <param name="ex">The exception that occurred.</param> /// <returns>A notification result or null.</returns> protected override PushNotificationResult HandleFailedNotificationResult(ApnsNotification notification, Exception ex) { ApnsNotificationException notificationException = ex as ApnsNotificationException; if (notificationException != null) { if (notificationException.ErrorStatusCode == ApnsNotificationErrorStatusCode.ConnectionError) { return (PushNotificationResult.Failed( this.EndPointName, "Connection error: " + ex.Message)); } return (PushNotificationResult.Failed( this.EndPointName, "Failed to send notification (" + notificationException.Notification.Identifier + ") with status (" + notificationException.ErrorStatusCode + ") and error message: " + ex.Message)); } return(null); }
private static void ApplePusher_OnSendFail(ApnsNotificationException exception) { Console.WriteLine(exception.Message); }