wordpress-mobile / wordpress-mobile/WordPress-Android

Handle new error codes from the media upload endpoint

Open
#12,325 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Type] Enhancement Media
Dominant language
Kotlin
Stars
3.2k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
69

Description

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:

  • rest_upload_limited_space
  • rest_upload_file_too_big
  • rest_upload_user_quota_exceeded

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"
}
  • On the network side (FluxC): It would be a good idea to split the error message (something linke .split("|")), store the error code in the FluxC event that is sent back to the app.
  • On the UI, we should handle that error and display the message correctly instead of showing a generic message. This must be done:
    • In the media library.
    • In the editor.
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Calypso media error list and the media upload endpoint response described in the issue. Trace how FluxC receives and sends upload errors, then follow the media library and editor handling. Done means the listed quota and file-size errors display their exact messages in both app surfaces instead of the generic error.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.