diff --git a/Amplify/Categories/API/Error/APIError.swift b/Amplify/Categories/API/Error/APIError.swift index 6d473e2f00..bbf0e1e826 100644 --- a/Amplify/Categories/API/Error/APIError.swift +++ b/Amplify/Categories/API/Error/APIError.swift @@ -54,7 +54,7 @@ extension APIError: AmplifyError { } } - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .unknown(let errorDescription, _, _): return "Unexpected error occurred with message: \(errorDescription)" diff --git a/Amplify/Categories/API/Response/GraphQLResponse.swift b/Amplify/Categories/API/Response/GraphQLResponse.swift index 295dbc9459..cfa7a77a30 100644 --- a/Amplify/Categories/API/Response/GraphQLResponse.swift +++ b/Amplify/Categories/API/Response/GraphQLResponse.swift @@ -33,7 +33,7 @@ public enum GraphQLResponseError: AmplifyError { /// An unknown error occurred case unknown(ErrorDescription, RecoverySuggestion, Error?) - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .error(let errors): return "GraphQL service returned a successful response containing errors: \(errors)" diff --git a/Amplify/Categories/Analytics/Error/AnalyticsError.swift b/Amplify/Categories/Analytics/Error/AnalyticsError.swift index bfcf791c4b..262cecdb1b 100644 --- a/Amplify/Categories/Analytics/Error/AnalyticsError.swift +++ b/Amplify/Categories/Analytics/Error/AnalyticsError.swift @@ -17,7 +17,7 @@ public enum AnalyticsError { extension AnalyticsError: AmplifyError { /// Error Description - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .configuration(let errorDescription, _, _): return errorDescription diff --git a/Amplify/Categories/Auth/Error/AuthError.swift b/Amplify/Categories/Auth/Error/AuthError.swift index 889f133cf7..ee83637673 100644 --- a/Amplify/Categories/Auth/Error/AuthError.swift +++ b/Amplify/Categories/Auth/Error/AuthError.swift @@ -51,20 +51,20 @@ extension AuthError: AmplifyError { } } - public var errorDescription: ErrorDescription { - switch self { - case .configuration(let errorDescription, _, _), - .service(let errorDescription, _, _), - .validation(_, let errorDescription, _, _), - .notAuthorized(let errorDescription, _, _), - .signedOut(let errorDescription, _, _), - .sessionExpired(let errorDescription, _, _), - .invalidState(let errorDescription, _, _): - return errorDescription - case .unknown(let errorDescription, _): - return "Unexpected error occurred with message: \(errorDescription)" - } - } +// public var errorDescription: ErrorDescription? { +// switch self { +// case .configuration(let errorDescription, _, _), +// .service(let errorDescription, _, _), +// .validation(_, let errorDescription, _, _), +// .notAuthorized(let errorDescription, _, _), +// .signedOut(let errorDescription, _, _), +// .sessionExpired(let errorDescription, _, _), +// .invalidState(let errorDescription, _, _): +// return errorDescription +// case .unknown(let errorDescription, _): +// return "Unexpected error occurred with message: \(errorDescription)" +// } +// } public var recoverySuggestion: RecoverySuggestion { switch self { @@ -113,3 +113,52 @@ extension AuthError: Equatable { } } } + +extension AuthError { + public var errorDescription: ErrorDescription? { + var message = "" + switch self { + case .configuration(let errorDescription, let recoverySuggestion, let error): + message = "Configuration error: \(errorDescription). \(recoverySuggestion)" + if let error = error { + message += " Underlying error: \(error.localizedDescription)" + } + case .service(let errorDescription, let recoverySuggestion, let error): + message = "Service error: \(errorDescription). \(recoverySuggestion)" + if let error = error { + message += " Underlying error: \(error.localizedDescription)" + } + case .unknown(let errorDescription, let error): + message = "Unknown error: \(errorDescription)" + if let error = error { + message += " Underlying error: \(error.localizedDescription)" + } + case .validation(let field, let errorDescription, let recoverySuggestion, let error): + message = "Validation error for field: \(field). \(errorDescription). \(recoverySuggestion)" + if let error = error { + message += " Underlying error: \(error.localizedDescription)" + } + case .notAuthorized(let errorDescription, let recoverySuggestion, let error): + message = "Not authorized error: \(errorDescription). \(recoverySuggestion)" + if let error = error { + message += " Underlying error: \(error.localizedDescription)" + } + case .signedOut(let errorDescription, let recoverySuggestion, let error): + message = "Signed out: \(errorDescription). \(recoverySuggestion)" + if let error = error { + message += " Underlying error: \(error.localizedDescription)" + } + case .sessionExpired(let errorDescription, let recoverySuggestion, let error): + message = "Session expired: \(errorDescription). \(recoverySuggestion)" + if let error = error { + message += " Underlying error: \(error.localizedDescription)" + } + case .invalidState(let errorDescription, let recoverySuggestion, let error): + message = "Invalid state: \(errorDescription). \(recoverySuggestion)" + if let error = error { + message += " Underlying error: \(error.localizedDescription)" + } + } + return "\(String(describing: Self.self)): \(message)" + } +} diff --git a/Amplify/Categories/DataStore/DataStoreError.swift b/Amplify/Categories/DataStore/DataStoreError.swift index e1954430f7..a7dfee19ea 100644 --- a/Amplify/Categories/DataStore/DataStoreError.swift +++ b/Amplify/Categories/DataStore/DataStoreError.swift @@ -27,7 +27,7 @@ public enum DataStoreError: Error { // MARK: - AmplifyError extension DataStoreError: AmplifyError { - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .api(let error, _): return error.errorDescription diff --git a/Amplify/Categories/Geo/Types/Geo+Error.swift b/Amplify/Categories/Geo/Types/Geo+Error.swift index d7e6b81615..3cc4045ea2 100644 --- a/Amplify/Categories/Geo/Types/Geo+Error.swift +++ b/Amplify/Categories/Geo/Types/Geo+Error.swift @@ -40,7 +40,7 @@ extension Geo.Error: AmplifyError { } /// Error Description - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .invalidConfiguration(let errorDescription, _, _), .networkError(let errorDescription, _, _), diff --git a/Amplify/Categories/Hub/HubError.swift b/Amplify/Categories/Hub/HubError.swift index 2e892573d3..5ee7d65705 100644 --- a/Amplify/Categories/Hub/HubError.swift +++ b/Amplify/Categories/Hub/HubError.swift @@ -12,7 +12,7 @@ public enum HubError { } extension HubError: AmplifyError { - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .configuration(let description, _, _), .unknownError(let description, _, _): diff --git a/Amplify/Categories/Logging/LoggingError.swift b/Amplify/Categories/Logging/LoggingError.swift index 047249ab4e..fc0b90dab0 100644 --- a/Amplify/Categories/Logging/LoggingError.swift +++ b/Amplify/Categories/Logging/LoggingError.swift @@ -11,7 +11,7 @@ public enum LoggingError { } extension LoggingError: AmplifyError { - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .configuration(let errorDescription, _, _): return errorDescription diff --git a/Amplify/Categories/Notifications/PushNotifications/Error/PushNotificationsError.swift b/Amplify/Categories/Notifications/PushNotifications/Error/PushNotificationsError.swift index 8f7694c69d..dba9d4ff5a 100644 --- a/Amplify/Categories/Notifications/PushNotifications/Error/PushNotificationsError.swift +++ b/Amplify/Categories/Notifications/PushNotifications/Error/PushNotificationsError.swift @@ -20,7 +20,7 @@ public enum PushNotificationsError { } extension PushNotificationsError: AmplifyError { - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .configuration(let description, _, _), .network(let description, _, _), diff --git a/Amplify/Categories/Predictions/Error/PredictionsError.swift b/Amplify/Categories/Predictions/Error/PredictionsError.swift index 76a0e23c5b..bafa515d9c 100644 --- a/Amplify/Categories/Predictions/Error/PredictionsError.swift +++ b/Amplify/Categories/Predictions/Error/PredictionsError.swift @@ -16,7 +16,7 @@ public enum PredictionsError { } extension PredictionsError: AmplifyError { - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .client(let clientError): return "A client error occurred with message:\(clientError.description)" diff --git a/Amplify/Categories/Storage/Error/StorageError.swift b/Amplify/Categories/Storage/Error/StorageError.swift index a34065650e..eba895f16d 100644 --- a/Amplify/Categories/Storage/Error/StorageError.swift +++ b/Amplify/Categories/Storage/Error/StorageError.swift @@ -59,7 +59,7 @@ public enum StorageError { } extension StorageError: AmplifyError { - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .accessDenied(let errorDescription, _, _), .authError(let errorDescription, _, _), diff --git a/Amplify/Core/Configuration/ConfigurationError.swift b/Amplify/Core/Configuration/ConfigurationError.swift index 36d7d7abab..acfac65ff8 100644 --- a/Amplify/Core/Configuration/ConfigurationError.swift +++ b/Amplify/Core/Configuration/ConfigurationError.swift @@ -39,7 +39,7 @@ public enum ConfigurationError { extension ConfigurationError: AmplifyError { /// - Tag: ConfigurationError.errorDescription - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .amplifyAlreadyConfigured(let description, _, _), .invalidAmplifyConfigurationFile(let description, _, _), diff --git a/Amplify/Core/Error/CoreError.swift b/Amplify/Core/Error/CoreError.swift index f6c628c764..82a25681a3 100644 --- a/Amplify/Core/Error/CoreError.swift +++ b/Amplify/Core/Error/CoreError.swift @@ -23,7 +23,7 @@ public enum CoreError { extension CoreError: AmplifyError { /// - Tag: CoreError.errorDescription - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .listOperation(let errorDescription, _, _), .clientValidation(let errorDescription, _, _): diff --git a/Amplify/Core/Plugin/PluginError.swift b/Amplify/Core/Plugin/PluginError.swift index 2e544f3c7a..bfc66e3407 100644 --- a/Amplify/Core/Plugin/PluginError.swift +++ b/Amplify/Core/Plugin/PluginError.swift @@ -22,7 +22,7 @@ public enum PluginError { } extension PluginError: AmplifyError { - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .mismatchedPlugin(let description, _, _), .noSuchPlugin(let description, _, _), diff --git a/Amplify/Core/Support/AmplifyError.swift b/Amplify/Core/Support/AmplifyError.swift index 207dbb1835..1b75a9c09a 100644 --- a/Amplify/Core/Support/AmplifyError.swift +++ b/Amplify/Core/Support/AmplifyError.swift @@ -34,12 +34,12 @@ public typealias TargetIdentityId = String /// recovery suggestions and error messages. /// /// - Tag: AmplifyError -public protocol AmplifyError: Error, CustomDebugStringConvertible { +public protocol AmplifyError: LocalizedError, CustomDebugStringConvertible { /// A localized message describing what error occurred. /// /// - Tag: AmplifyError.errorDescription - var errorDescription: ErrorDescription { get } + var errorDescription: ErrorDescription? { get } /// A localized message describing how one might recover from the failure. /// @@ -66,7 +66,7 @@ public extension AmplifyError { var debugDescription: String { let errorType = type(of: self) - var components = ["\(errorType): \(errorDescription)"] + var components = ["\(errorType): \(errorDescription ?? "")"] if !recoverySuggestion.isEmpty { components.append("Recovery suggestion: \(recoverySuggestion)") diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/AWSAPICategoryPluginError.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/AWSAPICategoryPluginError.swift index df65582cd6..1fcd933ce8 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/AWSAPICategoryPluginError.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/AWSAPICategoryPluginError.swift @@ -12,7 +12,7 @@ public enum AWSAPICategoryPluginError { } extension AWSAPICategoryPluginError: AmplifyError { - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .configuration(let errorDescription, _, _): return errorDescription diff --git a/AmplifyPlugins/Analytics/Sources/AWSPinpointAnalyticsPlugin/Support/Utils/AnalyticsErrorHelper.swift b/AmplifyPlugins/Analytics/Sources/AWSPinpointAnalyticsPlugin/Support/Utils/AnalyticsErrorHelper.swift index da6a74fe7b..49f2dd15e2 100644 --- a/AmplifyPlugins/Analytics/Sources/AWSPinpointAnalyticsPlugin/Support/Utils/AnalyticsErrorHelper.swift +++ b/AmplifyPlugins/Analytics/Sources/AWSPinpointAnalyticsPlugin/Support/Utils/AnalyticsErrorHelper.swift @@ -15,7 +15,7 @@ enum AnalyticsErrorHelper { case let error as AnalyticsErrorConvertible: return error.analyticsError case let error as AuthError: - return .configuration(error.errorDescription, error.recoverySuggestion, error) + return .configuration(error.errorDescription ?? "", error.recoverySuggestion, error) default: return getDefaultError(error as NSError) } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/CompleteTOTPSetup.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/CompleteTOTPSetup.swift index ef4a63e26a..e726964563 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/CompleteTOTPSetup.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/CompleteTOTPSetup.swift @@ -83,14 +83,14 @@ struct CompleteTOTPSetup: Action { await dispatcher.send(responseEvent) } catch let error as SignInError { - logError(error.authError.errorDescription, environment: environment) + logError(error.authError.errorDescription ?? "", environment: environment) let errorEvent = SignInEvent(eventType: .throwAuthError(error)) logVerbose("\(#fileID) Sending event \(errorEvent)", environment: environment) await dispatcher.send(errorEvent) } catch { let error = SignInError.service(error: error) - logError(error.authError.errorDescription, environment: environment) + logError(error.authError.errorDescription ?? "", environment: environment) let errorEvent = SignInEvent(eventType: .throwAuthError(error)) logVerbose("\(#fileID) Sending event \(errorEvent)", environment: environment) diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/SetUpTOTP.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/SetUpTOTP.swift index 9de32b8fb1..c1ffedd649 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/SetUpTOTP.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/SetUpTOTP.swift @@ -44,14 +44,14 @@ struct SetUpTOTP: Action { environment: environment) await dispatcher.send(responseEvent) } catch let error as SignInError { - logError(error.authError.errorDescription, environment: environment) + logError(error.authError.errorDescription ?? "", environment: environment) let errorEvent = SetUpTOTPEvent(eventType: .throwError(error)) logVerbose("\(#fileID) Sending event \(errorEvent)", environment: environment) await dispatcher.send(errorEvent) } catch { let error = SignInError.service(error: error) - logError(error.authError.errorDescription, environment: environment) + logError(error.authError.errorDescription ?? "", environment: environment) let errorEvent = SetUpTOTPEvent(eventType: .throwError(error)) logVerbose("\(#fileID) Sending event \(errorEvent)", environment: environment) diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/VerifyTOTPSetup.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/VerifyTOTPSetup.swift index dd1b37450d..e12ef0c7a3 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/VerifyTOTPSetup.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SoftwareTokenSetup/VerifyTOTPSetup.swift @@ -40,14 +40,14 @@ struct VerifyTOTPSetup: Action { environment: environment) await dispatcher.send(responseEvent) } catch let error as SignInError { - logError(error.authError.errorDescription, environment: environment) + logError(error.authError.errorDescription ?? "", environment: environment) let errorEvent = SetUpTOTPEvent(eventType: .throwError(error)) logVerbose("\(#fileID) Sending event \(errorEvent)", environment: environment) await dispatcher.send(errorEvent) } catch { let error = SignInError.service(error: error) - logError(error.authError.errorDescription, environment: environment) + logError(error.authError.errorDescription ?? "", environment: environment) let errorEvent = SetUpTOTPEvent(eventType: .throwError(error)) logVerbose("\(#fileID) Sending event \(errorEvent)", environment: environment) diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ClientBehavior/AWSCognitoAuthPlugin+UserBehavior.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ClientBehavior/AWSCognitoAuthPlugin+UserBehavior.swift index 21df88d96b..c7227d974f 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ClientBehavior/AWSCognitoAuthPlugin+UserBehavior.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ClientBehavior/AWSCognitoAuthPlugin+UserBehavior.swift @@ -99,6 +99,7 @@ public extension AWSCognitoAuthPlugin { } func getCurrentUser() async throws -> AuthUser { + print(AuthError.service("test", "test", AWSCognitoAuthError.aliasExists)) let taskHelper = AWSAuthTaskHelper(authStateMachine: authStateMachine) return try await taskHelper.getCurrentUser() } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/ErrorMapping/KeychainStoreError+AuthConvertible.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/ErrorMapping/KeychainStoreError+AuthConvertible.swift index 1a37569191..1d3aedfd00 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/ErrorMapping/KeychainStoreError+AuthConvertible.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/ErrorMapping/KeychainStoreError+AuthConvertible.swift @@ -22,9 +22,9 @@ extension KeychainStoreError: AuthErrorConvertible { case .codingError(let errorDescription, let error): return .configuration(errorDescription, self.recoverySuggestion, error) case .itemNotFound: - return .service(self.errorDescription, self.recoverySuggestion) + return .service(self.errorDescription ?? "", self.recoverySuggestion) case .securityError: - return .service(self.errorDescription, self.recoverySuggestion) + return .service(self.errorDescription ?? "", self.recoverySuggestion) } } } diff --git a/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift b/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift index 4de28d4697..006d777e0d 100644 --- a/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift +++ b/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift @@ -47,7 +47,7 @@ extension KeychainStoreError: AmplifyError { } /// Error Description - public var errorDescription: ErrorDescription { + public var errorDescription: ErrorDescription? { switch self { case .conversionError(let errorDescription, _), .codingError(let errorDescription, _): return errorDescription diff --git a/AmplifyPlugins/Core/AmplifyCredentials/CustomHttpClientEngine/FoundationClientEngineError.swift b/AmplifyPlugins/Core/AmplifyCredentials/CustomHttpClientEngine/FoundationClientEngineError.swift index 098a452431..23525b7a80 100644 --- a/AmplifyPlugins/Core/AmplifyCredentials/CustomHttpClientEngine/FoundationClientEngineError.swift +++ b/AmplifyPlugins/Core/AmplifyCredentials/CustomHttpClientEngine/FoundationClientEngineError.swift @@ -10,7 +10,7 @@ import Amplify import SmithyHTTPAPI struct FoundationClientEngineError: AmplifyError { - let errorDescription: ErrorDescription + let errorDescription: ErrorDescription? let recoverySuggestion: RecoverySuggestion let underlyingError: Error? diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngine.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngine.swift index fd30c9ecae..9f2d52d7a0 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngine.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngine.swift @@ -335,7 +335,7 @@ class RemoteSyncEngine: RemoteSyncEngineBehavior { } if case .failure(let dataStoreError) = result { - self.log.error(dataStoreError.errorDescription) + self.log.error(dataStoreError.errorDescription ?? "") self.log.error(dataStoreError.recoverySuggestion) if let underlyingError = dataStoreError.underlyingError { self.log.error("\(underlyingError)") diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/SubscriptionSync/IncomingAsyncSubscriptionEventToAnyModelMapper.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/SubscriptionSync/IncomingAsyncSubscriptionEventToAnyModelMapper.swift index 2e1aef7248..b22c009d46 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/SubscriptionSync/IncomingAsyncSubscriptionEventToAnyModelMapper.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/SubscriptionSync/IncomingAsyncSubscriptionEventToAnyModelMapper.swift @@ -83,7 +83,7 @@ final class IncomingAsyncSubscriptionEventToAnyModelMapper: Subscriber, AmplifyC case .success(let mutationSync): modelsFromSubscription.send(.payload(mutationSync)) case .failure(let failure): - log.error(failure.errorDescription) + log.error(failure.errorDescription ?? "") } } diff --git a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingError.swift b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingError.swift index e10a67b862..2bbc73e69a 100644 --- a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingError.swift +++ b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingError.swift @@ -11,7 +11,7 @@ import Foundation /// Represents domain-specific errors within the AWSCloudWatchLogPlugin subsystem. struct AWSCloudWatchLoggingError: AmplifyError { - var errorDescription: String + var errorDescription: String? var recoverySuggestion: String diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Configuration/AWSS3PluginPrefixResolver.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Configuration/AWSS3PluginPrefixResolver.swift index d7c970f15c..194dd9e909 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Configuration/AWSS3PluginPrefixResolver.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Configuration/AWSS3PluginPrefixResolver.swift @@ -56,7 +56,7 @@ extension StorageAccessLevelAwarePrefixResolver: AWSS3PluginPrefixResolver { guard let authError = error as? AuthError else { throw StorageError.unknown("Unknown Auth Error", error) } - throw StorageError.authError(authError.errorDescription, authError.recoverySuggestion) + throw StorageError.authError(authError.errorDescription ?? "", authError.recoverySuggestion) } } } diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Utils/StorageRequestUtils+Getter.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Utils/StorageRequestUtils+Getter.swift index ac610b39fb..c512dec15d 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Utils/StorageRequestUtils+Getter.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Utils/StorageRequestUtils+Getter.swift @@ -27,7 +27,7 @@ extension StorageRequestUtils { static func getSize(_ file: URL) throws -> UInt64 { if let error = validateFileExists(file) { - throw StorageError.localFileNotFound(error.errorDescription, error.recoverySuggestion) + throw StorageError.localFileNotFound(error.errorDescription ?? "", error.recoverySuggestion) } do {