iOS app crashes on Mobile API 500s

Description

The iOS app does not gracefully handle 5xx errors (as well as 4xx errors probably) from certain Mobile API endpoints. This line tries to deserialize API responses as JSON without checking that the response is well-formed JSON. In the case of a 500, the response body contains something like "Internal Server Error" instead of JSON, causing the deserialization to throw an error and crash the app.

While this won't cause a problem if courses.edx.org is up and performing correctly, it might become a problem if courses.edx.org is under heavy load and intermittently returning 503s, for example. Instead of the app telling users that the server is busy, it will just crash.

Steps to Reproduce

Add the line `raise Exception()` right here: https://github.com/edx/edx-platform/blob/master/lms/djangoapps/mobile_api/users/views.py#L277. Then, log in to the app.

Reason for Variance

None

Release Notes

None

Assignee

Unassigned

Reporter

Kyle McCormick

Labels

None

Customer

None

URL

None

Groups with Read-Only Access

None

Actual Points

None

Reach

None

Impact

None

Open edX Discourse Thread

None

Platform Map Area (Levels 1 & 2)

None

Platform Map Area (Levels 3 & 4)

None

Contributor Name

None

Blended Project Status Page

None

edX Squad

None

Product Rollout Framework

None

Content & Partner Success Lead

None

Marketing Lead

None

Learning Lead

None

Support Lead

None

Priority

Unset