Skip to content

Commit

Permalink
fix(auth) Add underlying cause to fetchAuthSession error (#2750)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Creaser <[email protected]>
  • Loading branch information
tylerjroach and mattcreaser authored Apr 1, 2024
1 parent 30a288e commit 0f61cc8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ open class CognitoCredentialsProvider @InternalAmplifyApi constructor(
AuthException(
"Failed to get credentials. " +
"Check if you are signed in and configured identity pools correctly.",
AmplifyException.TODO_RECOVERY_SUGGESTION
AmplifyException.TODO_RECOVERY_SUGGESTION,
authSession.toAWSAuthSession()?.awsCredentialsResult?.error
)
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ internal class LivenessWebSocket(
PredictionsException(
"Failed to start the face liveness session.",
error,
AmplifyException.TODO_RECOVERY_SUGGESTION
AmplifyException.RECOVERY_SUGGESTION_WITH_THROWABLE
)
)
}
Expand Down
10 changes: 9 additions & 1 deletion core/src/main/java/com/amplifyframework/AmplifyException.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import androidx.annotation.Nullable;
import androidx.core.util.ObjectsCompat;

import com.amplifyframework.annotations.InternalAmplifyApi;

import java.util.Objects;

/**
Expand All @@ -29,7 +31,13 @@ public class AmplifyException extends Exception {
* All Amplify Exceptions should have a recovery suggestion. This string can be used as a filler until one is
* defined but should ultimately be replaced.
*/
public static final String TODO_RECOVERY_SUGGESTION = "Sorry, we don't have a suggested fix for this error yet.";
public static final String TODO_RECOVERY_SUGGESTION = "Sorry, we don’t have a recovery suggestion for this error.";

/**
* This string is intended for internal use only.
*/
@InternalAmplifyApi
public static final String RECOVERY_SUGGESTION_WITH_THROWABLE = "See the attached exception for more details";

/**
* A common recovery suggestion for errors that are unexpected and could be originated from a bug.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ open class UnknownException(
) {
companion object {
const val RECOVERY_SUGGESTION_WITH_THROWABLE = "See the attached exception for more details"
const val RECOVERY_SUGGESTION_WITHOUT_THROWABLE = "Sorry, we don't have a suggested fix for this error yet."
const val RECOVERY_SUGGESTION_WITHOUT_THROWABLE = "Sorry, we dont have a recovery suggestion for this error."
}
}

0 comments on commit 0f61cc8

Please sign in to comment.