Skip to main content

Extra: Known exceptions

rook-sdk returns custom exceptions wrapped in a Result object in each function when an issue is encountered. Below there is a list of all ROOK exceptions, their description/cause 📜 and how to handle them if encountered 🔧.

DateNotValidForEventsException​

📜 The provided LocalDate is not in the allowed range to extract events.

🔧 Use a valid LocalDate; between 29 days (inclusive) and today (inclusive).

DateNotValidForSummariesException​

📜 The provided LocalDate is not in the allowed range to extract events.

🔧 Use a valid LocalDate; between 29 days ago (inclusive) and yesterday (inclusive).

DeviceNotSupportedException​

📜 The requested operation could not be completed because the current device is not supported by Health Connect.

🔧 Don't use Health Connect operations, follow the instruction in Availability documentation to easily identify incompatible devices.

HealthConnectNotInstalledException​

📜 The requested operation could not be completed because Health Connect is not installed, starting from Android 14, Health connect is preinstalled on all devices, so this will only happen on Android 13 or lower devices.

🔧 Ask the user to download Health Connect, you can use an Intent like below to directly open the PlayStore on the Health Connect page.

val intent = Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=com.google.android.apps.healthdata")
)

HttpRequestException​

📜 An HTTP request failed, this usually means an error in ROOK servers.

🔧 Check if you configured the SDK credentials correctly, if that is OK look for the code and error properties and send a report to ROOK support.

MissingAndroidPermissionsException​

📜 The requested operation requires Android permissions which are not granted.

🔧 Go to the Android permissions section in the documentation to check how you can request permissions.

MissingConfigurationException​

📜 A RookConfiguration instance was not provided to a RookConfigurationManager.

🔧 Provide the required RookConfiguration instance. More information here.

MissingHealthConnectPermissionsException​

📜 The requested operation requires Android permissions which are not granted.

🔧 Go to the Health Connect permissions section in the documentation to check how you can request permissions.

RequestQuotaExceededException​

📜 The Health Connect rate limited request quota has been exceeded, this will happen if you use the functions of RookEventManager or RookSummaryManager too many times.

🔧 Wait for a moment before syncing data again, the quota will be partially restored as the time passes so the longer you wait the more quota will be restored, we recommend waiting from 1 to 6 hours.

SDKNotAuthorizedException​

📜 The requested operation requires an authorization level that your clientUUID doesn't have.

🔧 Check if you configured the SDK credentials correctly, if that is OK send a report to ROOK support, some of the features of the SDK require a special level of authorization that are not included in the basic level.

SDKNotInitializedException​

📜 The SDK was not initialized or failed to initialize.

🔧 Call rookConfigurationManager.initRook() and wait for a successful result.

TimeoutException​

📜 An HTTP request waited too long and could not be completed. This can happen because an unavailable or unstable internet connection.

🔧 Check your connectivity and try again.

UserNotDeletedException​

📜 The current user could not be deleted from ROOK servers.

🔧 Call rookConfigurationManager.deleteUserFromRook() again.

UserNotInitializedException​

📜 The User was not initialized or failed to initialize.

🔧 Call rookConfigurationManager.updateUserID() and wait for a successful result.

UserNotRegisteredException​

📜 There was an error trying to register a user. This will often be an error from the ROOK API.

🔧 Check the exception message, if the message contains a 401 code it could be that your credentials were configured incorrectly or are wrong, fix them and call rookConfigurationManager.updateUserID() again. If the message contains an error related to the ROOK servers internal behaviour, send a report to ROOK support.