I want to display different errors to the user when they are logging in through AWS Amplify using Kotlin. This is what I have set up as my last parameter of Amplify.Auth.signIn():
{ error ->
inputEmail.error = "Check if the e-mail is valid"
inputPassword.error = "Check if the password is valid"
})
"error" is a "Throwable?" which I wanted to cast to various AWS exceptions and check whether the cast was a success. Yet all of the AWS Amplify exceptions are based on the Java version of "Throwable". Is there a way to make these casts work or is there an alternative way to identify error types in Kotlin?