wordpress-mobile / WordPress-iOS

WordPress for iOS - Official repository
http://ios.wordpress.org/
GNU General Public License v2.0
3.7k stars 1.12k forks source link

Handle new error codes from the media upload endpoint #14401

Open maxme opened 4 years ago

maxme commented 4 years ago

Expected behavior

In case of an error during media upload, we should show the exact error to help the user take a decision.

The list of errors are defined here in Calypso. Most interesting are:

Note that these error codes are actually stored in the message field. Here is an sample response we get from the https://public-api.wordpress.com/rest/v1.1/sites/{SITE_ID}/media/new/ API endpoint in case of an upload on a quota limited site:

{
    "error": "upload_error",
    "message": "rest_upload_user_quota_exceeded|You have used your space quota. Please delete files before uploading. Back"
}

Actual behavior

We show a generic error in the editor and in the media library:

Media Library Editor
1-post-1-file-not-uploaded-media-library-wpios-15 1 0 3 failed-to-insert-media-please-tap-for-options

More details on paaHJt-17e-p2

WPAndroid related ticket: https://github.com/wordpress-mobile/WordPress-Android/issues/12325

designsimply commented 4 years ago

This came up in an app review:

For a very brief period, I was able to upload photos. But you broke it again in one of the recent updates. I honestly don’t do much worth WordPress except make blog posts with pics. But now pics won’t upload.

Suggestion: Provide more detailed error messages when uploads fail.

1-star app review by Jentropy – Aug 12, 2020 | WPiOS 15.3

(internal reference: app-store-reviewId=6311920580)