Skip to content

Commit 7fc52b0

Browse files
committed
Make message specific to API level
1 parent a73dd85 commit 7fc52b0

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/exceptions/webauthn/WebAuthnNotSupportedException.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,15 @@ package com.amplifyframework.auth.cognito.exceptions.webauthn
1919
* Exception that is thrown because WebAuthn is not supported on the device. This indicates that either the device
2020
* did not ship with WebAuthn support, or that your application is missing a required dependency or service.
2121
*/
22-
class WebAuthnNotSupportedException internal constructor(cause: Throwable?) :
23-
WebAuthnFailedException(
24-
message = "WebAuthn is not supported on this device",
25-
recoverySuggestion = TODO_RECOVERY_SUGGESTION,
26-
cause = cause
27-
)
22+
class WebAuthnNotSupportedException internal constructor(
23+
message: String,
24+
cause: Throwable? = null
25+
) : WebAuthnFailedException(
26+
message = message,
27+
recoverySuggestion = TODO_RECOVERY_SUGGESTION,
28+
cause = cause
29+
) {
30+
internal constructor(
31+
cause: Throwable?
32+
) : this(message = "WebAuthn is not supported on this device", cause = cause)
33+
}

aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/helpers/WebAuthnHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ internal class WebAuthnHelper(
9595
throw e.toAuthException()
9696
}
9797
} else {
98-
throw WebAuthnNotSupportedException(cause = null)
98+
throw WebAuthnNotSupportedException("Passkeys are only supported on API 28 and above")
9999
}
100100
}
101101

0 commit comments

Comments
 (0)