openmobilehub / android-omh-auth

Apache License 2.0
4 stars 1 forks source link

Improve Error Handling and Consistency in OMH Android Auth SDK for Invalid Provider Paths #100

Closed dzuluaga closed 1 month ago

dzuluaga commented 3 months ago

Problem

When the OMH Android Auth SDK cannot find the correct provider due to invalid paths, it throws a generic error:

null cannot be cast to non-null type com.openmobilehub.android.auth.core.OmhAuthFactory

This error is unclear and doesn't help developers identify that the issue is with incorrect provider paths.

Expected Behavior

  1. Better Error Messages: The SDK should clearly indicate that the error is due to invalid or incorrect provider paths, helping developers quickly identify and fix the issue.

  2. Use of Constants: Replace string paths with predefined constants from the GMS and non-GMS libraries, similar to how it's done in the storage module (e.g., GoogleDriveGmsConstants.IMPLEMENTATION_PATH). This minimizes errors from using incorrect strings.

Action Items

  1. Improve Error Handling:

    • Update the SDK to throw a clear and specific error when invalid paths are provided.
    • Include guidance in the error message for checking or using the correct paths.
  2. Implement Constants:

    • Introduce constants for GMS and non-GMS paths in the Auth SDK.
    • Update the documentation to reflect the use of these constants.

Reference

Why This Matters

Clear error messages and consistent use of constants will improve the developer experience and reduce errors in configuration.