UX: show a generic error on upload for XHR status 0 (#10521)
This indication covers all cases of network errors, not just "cancelled by user". The post upload component already has its own handling for user-cancelled uploads, but the generic upload component does not. Tested by stopping my localhost server right before attempting to upload a file.
This commit is contained in:
parent
7277ca6cb6
commit
93e136ae0e
|
@ -269,8 +269,9 @@ export function getUploadMarkdown(upload) {
|
|||
export function displayErrorForUpload(data, siteSettings) {
|
||||
if (data.jqXHR) {
|
||||
switch (data.jqXHR.status) {
|
||||
// cancelled by the user
|
||||
// didn't get headers from server, or browser refuses to tell us
|
||||
case 0:
|
||||
bootbox.alert(I18n.t("post.errors.upload"));
|
||||
return;
|
||||
|
||||
// entity too large, usually returned from the web server
|
||||
|
|
|
@ -106,7 +106,7 @@ export default Mixin.create({
|
|||
});
|
||||
|
||||
$upload.on("fileuploadfail", (e, data) => {
|
||||
if (!data || data.errorThrown !== "abort") {
|
||||
if (!data) {
|
||||
displayErrorForUpload(data, this.siteSettings);
|
||||
}
|
||||
reset();
|
||||
|
|
Loading…
Reference in New Issue