@@ -39,8 +39,7 @@ apnsBroker.OnNotificationFailed += (notification, aggregateEx) => {
39
39
aggregateEx .Handle (ex => {
40
40
41
41
// See what kind of exception it was to further diagnose
42
- if (ex is ApnsNotificationException ) {
43
- var notificationException = (ApnsNotificationException )ex ;
42
+ if (ex is ApnsNotificationException notificationException ) {
44
43
45
44
// Deal with the failed notification
46
45
var apnsNotification = notificationException .Notification ;
@@ -126,16 +125,14 @@ gcmBroker.OnNotificationFailed += (notification, aggregateEx) => {
126
125
aggregateEx .Handle (ex => {
127
126
128
127
// See what kind of exception it was to further diagnose
129
- if (ex is GcmNotificationException ) {
130
- var notificationException = (GcmNotificationException )ex ;
128
+ if (ex is GcmNotificationException notificationException ) {
131
129
132
130
// Deal with the failed notification
133
131
var gcmNotification = notificationException .Notification ;
134
132
var description = notificationException .Description ;
135
133
136
134
Console .WriteLine ($" {provider } Notification Failed: ID={gcmNotification .MessageId }, Desc={description }" );
137
- } else if (ex is GcmMulticastResultException ) {
138
- var multicastException = (GcmMulticastResultException )ex ;
135
+ } else if (ex is GcmMulticastResultException multicastException ) {
139
136
140
137
foreach (var succeededNotification in multicastException .Succeeded ) {
141
138
Console .WriteLine ($" {provider } Notification Succeeded: ID={succeededNotification .MessageId }" );
@@ -148,8 +145,7 @@ gcmBroker.OnNotificationFailed += (notification, aggregateEx) => {
148
145
Console .WriteLine ($" {provider } Notification Failed: ID={n .MessageId }, Desc={e .Description }" );
149
146
}
150
147
151
- } else if (ex is DeviceSubscriptionExpiredException ) {
152
- var expiredException = (DeviceSubscriptionExpiredException )ex ;
148
+ } else if (ex is DeviceSubscriptionExpiredException expiredException ) {
153
149
154
150
var oldId = expiredException .OldSubscriptionId ;
155
151
var newId = expiredException .NewSubscriptionId ;
@@ -160,8 +156,8 @@ gcmBroker.OnNotificationFailed += (notification, aggregateEx) => {
160
156
// If this value isn't null, our subscription changed and we should update our database
161
157
Console .WriteLine ($" Device RegistrationId Changed To: {newId }" );
162
158
}
163
- } else if (ex is RetryAfterException ) {
164
- var retryException = ( RetryAfterException ) ex ;
159
+ } else if (ex is RetryAfterException retryException ) {
160
+
165
161
// If you get rate limited, you should stop sending messages until after the RetryAfterUtc date
166
162
Console .WriteLine ($" {provider } Rate Limited, don't send more until after {retryException .RetryAfterUtc }" );
167
163
} else {
@@ -218,8 +214,7 @@ wnsBroker.OnNotificationFailed += (notification, aggregateEx) => {
218
214
aggregateEx .Handle (ex => {
219
215
220
216
// See what kind of exception it was to further diagnose
221
- if (ex is WnsNotificationException ) {
222
- var notificationException = (WnsNotificationException )ex ;
217
+ if (ex is WnsNotificationException notificationException ) {
223
218
Console .WriteLine ($" WNS Notification Failed: {notificationException .Message }" );
224
219
} else {
225
220
Console .WriteLine (" WNS Notification Failed for some (Unknown Reason)" );
0 commit comments