Skip to content

Commit 07724ea

Browse files
authored
fix(PushNotifications): Fixing .network error not being correctly reported (#3314)
1 parent 8e987b1 commit 07724ea

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

AmplifyPlugins/Notifications/Push/Sources/AWSPinpointPushNotificationsPlugin/Error/CommonRunTimeError+PushNotificationsErrorConvertible.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ import AwsCommonRuntimeKit
1212

1313
extension CommonRunTimeError: PushNotificationsErrorConvertible {
1414
var pushNotificationsError: PushNotificationsError {
15+
if isConnectivityError {
16+
return .network(
17+
PushNotificationsPluginErrorConstants.deviceOffline.errorDescription,
18+
PushNotificationsPluginErrorConstants.deviceOffline.recoverySuggestion,
19+
self
20+
)
21+
}
22+
1523
switch self {
1624
case .crtError(let crtError):
17-
let errorDescription = isConnectivityError
18-
? AWSPinpointErrorConstants.deviceOffline.errorDescription
19-
: crtError.message
20-
return .unknown(errorDescription, self)
25+
return .unknown(crtError.message, self)
2126
}
2227
}
2328
}

0 commit comments

Comments
 (0)