#25849 closed enhancement (fixed)
Better Error Messages for the Media Uploader
Reported by: | chriscct7 | Owned by: | |
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | 3.7 |
Component: | Media | Keywords: | needs-patch |
Focuses: | Cc: |
Description
Right now, the error messages the Media Uploader returns are extremely generic.For example:
"An error occurred in the upload. Please try again later."
and "HTTP Error"
This makes it really hard to figure out what the issue is that needs solving.
Better error messaging would be a much appreciated improvement to the media uploader.
Attachments (1)
Change History (11)
#2
@
11 years ago
- Type changed from feature request to enhancement
- Version changed from trunk to 3.7
#3
@
10 years ago
- Keywords needs-patch added
I'd love to see the error codes included. We get this problem with one of our extensions for Easy Digital Downloads all the time. Usually it's related to another plugin or theme causing an issue of some kind, but without error codes it's excruciatingly difficult to troubleshoot.
#4
@
10 years ago
One of the plugins I wrote lets users upload files on the frontend using the core WordPress Media Uploader. From our experience in support, there are probably at least a dozen different ways to trigger the exact same generic message listed above, and the only way to find the actual causation for the issue on a site is a very time consuming 1 by 1 crossing off the list of ways we know we can trigger it approach. With better error messages, when the error message is shown, it would let developers, users, and site owners know exactly what the problem is.
Here's a partial of our list of the ways you can trigger that message:
- lack of permissions (capabilities)
- lack of memory (overload during upload process)
- lack of permissions on the upload folder
- another plugin moving the upload location using the filter to another place that isn't supported (permissions)
- any sort of blocking to admin-ajax.php (extreme caching, security plugin, htaccess rule) when the upload tab has been defined as the default open to tab in JS
- the user being logged out during the upload
- some versions of PHP 5.2 apparently don't play nice with the uploader
There's only 2 ways (at least that I've seen) to get a unique error message:
- non-supported file type
- filesize over upload limit
The current error system is really frustrating to work with, as there's no guidance on what the error is. If an error message is to be shown, it should say what triggered it (even if it just wants to give us a list of reasons), so we have some place to start debugging.
#5
@
10 years ago
As suggested by @chriscct7, there are some improvements that we can make to try and better communicate the nature of errors so that users can pass along errors so that they can be addressed.
- Permission errors are not passed as JSON back to the client with some sort of message. While testing, I discovered that the drag and drop interface to upload media is not disabled for users that do not have the
upload_files
capability, which is what I used to test this.
- Multisite size errors are not passed to the client as JSON. See #29891
- In cases where there is some sort of server glitch or misconfiguration, the status code of the HTTP response is not provided in the error presented to the user.
In 25849-01.patch, I added better error responses for the permission errors. I also cleaned up the code a bit by using wp_send_json_error()
and wp_send_json_success()
.
#7
follow-up:
↓ 8
@
10 years ago
- Milestone changed from Awaiting Review to 4.1
What else needs to happen here?
#8
in reply to:
↑ 7
;
follow-up:
↓ 9
@
10 years ago
- Resolution set to fixed
- Status changed from new to closed
Replying to helen:
What else needs to happen here?
There are some other error scenarios which still result in a generic error message.
chriscct7: Can you open a new ticket with your list of error scenarios and we'll look at handling these in 4.2.
#9
in reply to:
↑ 8
@
10 years ago
Replying to johnbillion:
Yep, going to do another sweep at the media manager and make sure the remaining items on that list are still valid, and is comprehensive and then will open another ticket and link back to here.
Replying to helen:
What else needs to happen here?
There are some other error scenarios which still result in a generic error message.
chriscct7: Can you open a new ticket with your list of error scenarios and we'll look at handling these in 4.2.
These generic error messages are used as fallback messages when the specific error is unknown. Typically they should never be shown.
It sounds like an error is happening on your site that is not being accounted for. We could improve these messages by including the error code when it's available (ie. Plupload's error code or SWFUpload's error code) to help with debugging.