Pick the fix
The ViewModel shows e.message to users, which reads 'HTTP 503 Service Unavailable'. Best fix?
Hint 1 of 1
Who should know what HTTP 503 means?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Map exceptions to app errors in the repository and show a message per error type in the UI
Correct. Users get useful text and the UI doesn't depend on HTTP details.
Why not the others?
- B Catch Exception and show 'Something went wrong' for everything. Loses the difference between offline and server errors.
- C Hide all errors. Users need to know when something failed.
- D Throw a RuntimeException with a nicer message. Still an exception crossing layers.