wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.99k stars 1.33k forks source link

Handle new error codes from the media upload endpoint #12325

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
exceeds_site_space_quota_limit failed-to-insert-media-wpandroid-15 1-rc-2

More details on paaHJt-17e-p2

WPiOS related ticket: https://github.com/wordpress-mobile/WordPress-iOS/issues/14401

designsimply commented 3 years ago

When an image upload fails for an image larger than 2650 x 2650 pixels on a Bluehost Jetpack site, there is a very generic error message both in the Media and the Editor—would it be possible to improve this error message in the app?

Media upload failed. CURL error 28: Operation timed out after 30001 mil…

Screenshot_20210407-191738 Screenshot_20210407-191617 Tested with WPAndroid 17.1-rc-1 on Pixel 3 Android 11.

The following error is shown on the Bluehost WP Admin Media screen if I try uploading the same image there, and it's a much better error message:

Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels.

image

Image upload error for an 5.1 MB, 4032 x 3024 image seen at testingallthetime.com/wp-admin/upload.php — Bluehost site running Jetpack 9.5.

In the WordPress app, I think we could improve this error even further if we ask users to try adjusting their image optimization settings in App Settings.

image

My Site > Account > App Setings > Maximum Image Size settings seen in WPAndroid 17.1-rc-1 on Pixel 3 Android 11.

(internal reference: 6510-gh-Automattic/jpop-issues#issuecomment-815361481)

mchowning commented 2 years ago

There have been some improvements in this area, which are discussed in https://github.com/wordpress-mobile/gutenberg-mobile/issues/2448