-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type comparison with UnderlyingExceptions might not be working as expected. #4693
Comments
Hello @joaoantoniomartinsfilho _$UserLambdaValidationException extends UserLambdaValidationException. Here is the class definition. It is an internal class used for json serialization with built_value. If you want to check if the exception is a UserLambdaValidationException you can do the following. if (e is UserLambdaValidationException) {
// handle exception
} Let me know if you have any other questions. |
Hey @Jordan-Nelson, how's it going? Thanks for the reply. Do you mean checking directly the underlying exception, instead of the runtime type? |
Hey @Jordan-Nelson , I followed your suggestion, but even after that, the comparison using the Did I misunderstand something, or is there something else I need to consider? |
@joaoantoniomartinsfilho You are not missing anything. That looks like unexpected behavior. We will see if we can reproduce it. |
Hello @joaoantoniomartinsfilho - This does appear to be a bug. The exception is not getting mapped correctly. The reason that you are not able to type check the underlying exception is that there are actually two Thanks for raising the issue. I will look into a fix and let you know when we have an update. |
@jmartins-sh - This issue was addressed in Amplify Flutter v2 which was released a couple weeks ago. There were some breaking changes in this version. Please see the upgrade guide for more info. |
Hey @Jordan-Nelson, thanks for the reply. I just have one more question, is the lib amplify-flutter independent of Amplify Gen 2 right? Or Am I getting this wrong? My project is currently running in Amplify Gen 1 (amplify-cli and cloud). Will we face any issues using the lib 2.0? Appreciate it. |
Hi @jmartins-sh - Amplify Flutter v2 is compatible with Amplify Gen 1 and Amplify Gen 2. |
Description
Hello there! I'm currently testing scenarios where Cognito triggers (Lambdas) might return validation errors. While catching the
LambdaException
, I noticed that the underlying exception has a prefix of "_$".For example, I encountered
_$UserLambdaValidationException
, whereas the exception provided by amplify-flutter is simplyUserLambdaValidationException
(without the "_$").Is this expected behavior? Did I misunderstand something?
Appreciate the help. :)
Categories
Steps to Reproduce
Screenshots
Platforms
Flutter Version
3.19.1
Amplify Flutter Version
1.7.0
Deployment Method
Amplify CLI
Schema
No response
The text was updated successfully, but these errors were encountered: