From dd61ad20e4de6a0bb1733678b5c19360265a656a Mon Sep 17 00:00:00 2001 From: Sai Venkat Desu Date: Wed, 7 Aug 2024 12:33:26 +0530 Subject: [PATCH] BREAKING CHANGE: updated description of AuthenticationException in case of empty description --- .../auth0/android/authentication/AuthenticationException.kt | 2 +- .../android/authentication/AuthenticationExceptionTest.kt | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/auth0/src/main/java/com/auth0/android/authentication/AuthenticationException.kt b/auth0/src/main/java/com/auth0/android/authentication/AuthenticationException.kt index c0ec9041..1eea076e 100644 --- a/auth0/src/main/java/com/auth0/android/authentication/AuthenticationException.kt +++ b/auth0/src/main/java/com/auth0/android/authentication/AuthenticationException.kt @@ -86,7 +86,7 @@ public class AuthenticationException : Auth0Exception { if (!TextUtils.isEmpty(description)) { return description!! } - return if (UNKNOWN_ERROR == getCode()) { + return if (UNKNOWN_ERROR != getCode()) { String.format("Received error with code %s", getCode()) } else "Failed with unknown error" } diff --git a/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt b/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt index e1bb2cfb..caa89b3a 100644 --- a/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt +++ b/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt @@ -134,8 +134,7 @@ public class AuthenticationExceptionTest { CoreMatchers.`is`( CoreMatchers.equalTo( String.format( - "Received error with code %s", - Auth0Exception.UNKNOWN_ERROR + "Failed with unknown error" ) ) ) @@ -150,7 +149,7 @@ public class AuthenticationExceptionTest { ) MatcherAssert.assertThat( ex.getDescription(), - CoreMatchers.`is`(CoreMatchers.equalTo("Failed with unknown error")) + CoreMatchers.`is`(CoreMatchers.equalTo("Received error with code a_valid_code")) ) }