better error message if image upload fails, #1052

This commit is contained in:
Baris Soner Usakli
2014-02-18 00:25:30 -05:00
parent 9d1a295b85
commit 83ad454c3e
2 changed files with 6 additions and 6 deletions

View File

@@ -604,10 +604,8 @@ define(['taskbar'], function(taskbar) {
clearForm: true,
formData: formData,
error: function(xhr) {
app.alertError('Error uploading file! ' + xhr.status);
composer.posts[post_uuid].uploadsInProgress.pop();
app.alertError('Error uploading file!\nStatus : ' + xhr.status + '\nMessage : ' + xhr.responseText);
},
uploadProgress: function(event, position, total, percent) {
var current = textarea.val();
for(var i=0; i<files.length; ++i) {
@@ -615,7 +613,6 @@ define(['taskbar'], function(taskbar) {
textarea.val(current.replace(re, files[i].name+'](uploading ' + percent + '%)'));
}
},
success: function(uploads) {
if(uploads && uploads.length) {
@@ -626,8 +623,11 @@ define(['taskbar'], function(taskbar) {
}
}
composer.posts[post_uuid].uploadsInProgress.pop();
textarea.focus();
},
complete: function(xhr, status) {
uploadForm[0].reset();
composer.posts[post_uuid].uploadsInProgress.pop();
}
});