updates #161 Proper error messages and include server response

This commit is contained in:
JC Brand 2018-04-24 10:09:45 +02:00
parent e0aaeb66ea
commit 9a410c6a96

View File

@ -151,10 +151,7 @@
'message': this.get('get')
});
} else {
this.save({
'upload': _converse.FAILURE,
'message': __('Sorry, could not succesfully upload your file')
});
xhr.onerror();
}
}
};
@ -164,9 +161,14 @@
}
}, false);
xhr.onerror = () => {
let message = __('Sorry, could not succesfully upload your file.');
if (xhr.responseText) {
message += ' ' + __('Your server\'s response: "%1$s"', xhr.responseText)
}
this.save({
'type': 'error',
'upload': _converse.FAILURE,
'message': __('Sorry, could not succesfully upload your file')
'message': message
});
};
xhr.open('PUT', this.get('put'), true);