apps-android-commons icon indicating copy to clipboard operation
apps-android-commons copied to clipboard

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

Open shashankiitbhu opened this issue 1 year ago • 1 comments

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 avatar Mar 23 '24 11:03 shashankiitbhu

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

shashankiitbhu avatar Mar 24 '24 06:03 shashankiitbhu

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

shashankiitbhu avatar Mar 27 '24 17:03 shashankiitbhu

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 avatar Apr 09 '24 14:04 nicolas-raoul

@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 avatar Apr 09 '24 15:04 shashankiitbhu

@nicolas-raoul added a PR fixing this #5685

shashankiitbhu avatar Apr 09 '24 17:04 shashankiitbhu