'Exposing error messages from Auth.forgotPassword and other Auth methods

Is there a way to see all available error messages that are returned from the @aws-amplify/auth Auth methods?

When calling Auth.forgotPassword with the correct username, I receive the verification code to reset my password. However, when I put an invalid username, there is no error. Am I doing something incorrect here? I receive the LimiteRateExceeded error when trying too many times but nothing else.

Its worth noting that I am not using the default amplify react ui and am using my own form that calls the onSubmit.

Here is my onSubmit function that calls Auth.forgotPassword

const onSubmitStep1 = async (formData: any) => {
        console.log('formData1', formData)
        setSubmitting(true)
        await Auth.forgotPassword(formData.email)
            .then(() => {
                setSubmitting(false)
                stepForward()
            })
            .catch((err) => {
                console.log(err.message)
                setAmplifyErrors({
                    ...amplifyErrors,
                    form1: err.message,
                })
            })
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source