Closed mariha closed 4 years ago
Hey @saemy, it should be good for the review. I thought I rebased my branch on warmshowrs/develop
, looks like I didn't though... so I had to merge at the end. If it was an issue let me know and I'll create fresh branch with clean history.
Please disregard this PR, I created #355 instead.
When user creates an account the e-mail address they provided needs to be verified. Util they confirm, they can log in but they don't have access to most resources so the server returns 403 errors. I changed the code so that they get a message with some hints what is going on. This solves https://github.com/warmshowers/wsandroid/issues/327.
This could happen when loading users on the Map, Searching for specific users or checking Messages. I updated all these places. We might also consider sending a request to check permissions when user logs in for the first time on the device (seems for me more intuitive).
I added filtering to exception handling. It is based on http error codes, so that:
403 Forbidden
response results in returningaccess_denied
string from the resources (added), mapped to Access denied. Please check your email for account confirmation message. (proposition)500 Internal server error
response results in returninginternal_server_error
string (added), mapped to Oops... This is on us, sorry! Something has gone wrong on the server side. Please try again later.Also:
message_thread_create_failed
,messages_reload_failed
andmessage_send_failed
are not used anywhere any more so I removed themI was thinking of changing error handling, moving towards having one place where different exception types and http error codes are translated to messages and displayed, so that it is more uniform across that app and we could easily hook some more robust logging/analytics. So far I started to placed it in
HttpErrorHelper
. And I changedError
s toHttpException
s where applicable so we could differentiate exception handling behavior based on ex type and error code.I tried (quite hard) to write tests for my changes, gave up with threads though. I still hope to come back to it later.