Skip to content

Commit 0f61cc8

Browse files
fix(auth) Add underlying cause to fetchAuthSession error (#2750)
Co-authored-by: Matt Creaser <[email protected]>
1 parent 30a288e commit 0f61cc8

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

aws-core/src/main/java/com/amplifyframework/auth/CognitoCredentialsProvider.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ open class CognitoCredentialsProvider @InternalAmplifyApi constructor(
4747
AuthException(
4848
"Failed to get credentials. " +
4949
"Check if you are signed in and configured identity pools correctly.",
50-
AmplifyException.TODO_RECOVERY_SUGGESTION
50+
AmplifyException.TODO_RECOVERY_SUGGESTION,
51+
authSession.toAWSAuthSession()?.awsCredentialsResult?.error
5152
)
5253
)
5354
},

aws-predictions/src/main/java/com/amplifyframework/predictions/aws/http/LivenessWebSocket.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ internal class LivenessWebSocket(
254254
PredictionsException(
255255
"Failed to start the face liveness session.",
256256
error,
257-
AmplifyException.TODO_RECOVERY_SUGGESTION
257+
AmplifyException.RECOVERY_SUGGESTION_WITH_THROWABLE
258258
)
259259
)
260260
}

core/src/main/java/com/amplifyframework/AmplifyException.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import androidx.annotation.Nullable;
2020
import androidx.core.util.ObjectsCompat;
2121

22+
import com.amplifyframework.annotations.InternalAmplifyApi;
23+
2224
import java.util.Objects;
2325

2426
/**
@@ -29,7 +31,13 @@ public class AmplifyException extends Exception {
2931
* All Amplify Exceptions should have a recovery suggestion. This string can be used as a filler until one is
3032
* defined but should ultimately be replaced.
3133
*/
32-
public static final String TODO_RECOVERY_SUGGESTION = "Sorry, we don't have a suggested fix for this error yet.";
34+
public static final String TODO_RECOVERY_SUGGESTION = "Sorry, we don’t have a recovery suggestion for this error.";
35+
36+
/**
37+
* This string is intended for internal use only.
38+
*/
39+
@InternalAmplifyApi
40+
public static final String RECOVERY_SUGGESTION_WITH_THROWABLE = "See the attached exception for more details";
3341

3442
/**
3543
* A common recovery suggestion for errors that are unexpected and could be originated from a bug.

core/src/main/java/com/amplifyframework/auth/exceptions/UnknownException.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ open class UnknownException(
3131
) {
3232
companion object {
3333
const val RECOVERY_SUGGESTION_WITH_THROWABLE = "See the attached exception for more details"
34-
const val RECOVERY_SUGGESTION_WITHOUT_THROWABLE = "Sorry, we don't have a suggested fix for this error yet."
34+
const val RECOVERY_SUGGESTION_WITHOUT_THROWABLE = "Sorry, we dont have a recovery suggestion for this error."
3535
}
3636
}

0 commit comments

Comments
 (0)