From 3ee4310abded6e257a33b689ffbd805d3a011ab4 Mon Sep 17 00:00:00 2001 From: Kevin van der Burg Date: Wed, 23 Aug 2023 11:31:27 +0200 Subject: [PATCH 1/2] Added a more descriptive error message for AuthorizationExceptions --- android/src/main/java/com/rnappauth/RNAppAuthModule.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/rnappauth/RNAppAuthModule.java b/android/src/main/java/com/rnappauth/RNAppAuthModule.java index b775886e..5b503f29 100644 --- a/android/src/main/java/com/rnappauth/RNAppAuthModule.java +++ b/android/src/main/java/com/rnappauth/RNAppAuthModule.java @@ -1019,7 +1019,12 @@ private void handleAuthorizationException(final String fallbackErrorCode, final if (ex.getLocalizedMessage() == null) { promise.reject(fallbackErrorCode, ex.error, ex); } else { - promise.reject(ex.error != null ? ex.error: fallbackErrorCode, ex.getLocalizedMessage(), ex); + String message = ex.getLocalizedMessage(); + if(ex.getCause() != null) { + message += "- Cause: " + ex.getCause().getLocalizedMessage(); + } + + promise.reject(ex.error != null ? ex.error: fallbackErrorCode, message, ex); } } From 96656a6c801583e69c815ae34b6db75d10dcd7a1 Mon Sep 17 00:00:00 2001 From: Kevin van der Burg Date: Wed, 23 Aug 2023 11:35:37 +0200 Subject: [PATCH 2/2] Added extra space before - Cause --- android/src/main/java/com/rnappauth/RNAppAuthModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/rnappauth/RNAppAuthModule.java b/android/src/main/java/com/rnappauth/RNAppAuthModule.java index 5b503f29..a96602bb 100644 --- a/android/src/main/java/com/rnappauth/RNAppAuthModule.java +++ b/android/src/main/java/com/rnappauth/RNAppAuthModule.java @@ -1021,7 +1021,7 @@ private void handleAuthorizationException(final String fallbackErrorCode, final } else { String message = ex.getLocalizedMessage(); if(ex.getCause() != null) { - message += "- Cause: " + ex.getCause().getLocalizedMessage(); + message += " - Cause: " + ex.getCause().getLocalizedMessage(); } promise.reject(ex.error != null ? ex.error: fallbackErrorCode, message, ex);