Skip to content
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

Fix - No Precise Error Message After Error Due to Password Change #5643

Merged

Conversation

shashankiitbhu
Copy link
Contributor

@shashankiitbhu shashankiitbhu commented Mar 23, 2024

Description (required)

Fixes #5642

What changes did you make and why?

I identified the source of all these Errors (Which is No Accurate Information Provided to the User as to why an operation has failed because of a Single Type Of Exception that is getting lost due to Multiple layers of method calls), Hence I made a separate Exception Class for that Exception called - IvalidLoginTokenException so that it is easier to Identify and Propagate it.

Then I handled that Exception for each of the cases and since all of these Exceptions are the same their action is also Similar which is to Notify the user that Their Login Session has Expired Due to Password Change and They Must Login Again

Tests performed (required)

Tested on Xiaomi 11 Lite NE with API level 33.

@shashankiitbhu shashankiitbhu marked this pull request as draft March 23, 2024 11:34
@shashankiitbhu shashankiitbhu marked this pull request as ready for review March 23, 2024 13:38
@shashankiitbhu
Copy link
Contributor Author

@nicolas-raoul @sivaraam @whym Please Review this PR

# Conflicts:
#	app/src/main/java/fr/free/nrw/commons/review/ReviewImageFragment.java
# Conflicts:
#	app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java
# Conflicts:
#	app/src/main/java/fr/free/nrw/commons/review/ReviewController.java
#	app/src/main/java/fr/free/nrw/commons/review/ReviewImageFragment.java
@shashankiitbhu
Copy link
Contributor Author

@nicolas-raoul @psh @whym @sivaraam Fixed all merge conflicts Please Review

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working great!
After changing password and trying "thank":
Screenshot_20240401-172050.png

@nicolas-raoul nicolas-raoul merged commit 3d1efec into commons-app:main Apr 1, 2024
1 check passed
@nicolas-raoul
Copy link
Member

Even though the above says 1 check passed : Run tests and generate APK, somehow the two unit tests below started failing in branch main from the present commit.

fr.free.nrw.commons.description.DescriptionEditActivityUnitTest > testUpdateDescription FAILED
    java.lang.reflect.InvocationTargetException at DescriptionEditActivityUnitTest.kt:120
        Caused by: fr.free.nrw.commons.auth.csrf.InvalidLoginTokenException at DescriptionEditActivityUnitTest.kt:120

fr.free.nrw.commons.description.DescriptionEditActivityUnitTest > testOnSubmitButtonClicked FAILED
    java.lang.reflect.InvocationTargetException at DescriptionEditActivityUnitTest.kt:132
        Caused by: fr.free.nrw.commons.auth.csrf.InvalidLoginTokenException at DescriptionEditActivityUnitTest.kt:132

Any idea what might be causing this, or even how to fix the tests? Thanks! :-)

@shashankiitbhu
Copy link
Contributor Author

shashankiitbhu commented Apr 9, 2024

@nicolas-raoul Seems like this error is due to Unchecked Exception at editDescription() Method that is added later on in another commit, looking into it.

@shashankiitbhu
Copy link
Contributor Author

@nicolas-raoul added a PR fixing this #5685

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: No Precise Error Message After Error Due to Password Change
2 participants