diff --git a/packages/react-native-device-activity/ios/ReactNativeDeviceActivityModule.swift b/packages/react-native-device-activity/ios/ReactNativeDeviceActivityModule.swift index 655ce1b..24d3eca 100644 --- a/packages/react-native-device-activity/ios/ReactNativeDeviceActivityModule.swift +++ b/packages/react-native-device-activity/ios/ReactNativeDeviceActivityModule.swift @@ -547,7 +547,13 @@ public class ReactNativeDeviceActivityModule: Module { try await ac.requestAuthorization( for: forIndividualOrChild == "child" ? .child : .individual) } else { - logger.log("⚠️ iOS 16.0 or later is required to request authorization.") + let errorMessage = "iOS 16.0 or later is required to request authorization." + logger.log("⚠️ \(errorMessage)") + throw NSError( + domain: "FamilyControls", + code: 9999, + userInfo: [NSLocalizedDescriptionKey: errorMessage] + ) } } diff --git a/packages/react-native-device-activity/src/index.ts b/packages/react-native-device-activity/src/index.ts index 47f4ed4..938f02d 100644 --- a/packages/react-native-device-activity/src/index.ts +++ b/packages/react-native-device-activity/src/index.ts @@ -39,8 +39,8 @@ export async function requestAuthorization( forIndividualOrChild, ); } catch (error) { - // seems like we get a promise rejection if the user denies the authorization, but we can still request again - console.error(error); + // Re-throw the error so it can be properly handled by the caller + throw error; } }