apps-android-commons
apps-android-commons copied to clipboard
Fix - No Precise Error Message After Error Due to Password Change
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.
@nicolas-raoul @sivaraam @whym Please Review this PR
@nicolas-raoul @psh @whym @sivaraam Fixed all merge conflicts Please Review
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! :-)
@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.
@nicolas-raoul added a PR fixing this #5685