Commit 9a410c6a authored by JC Brand's avatar JC Brand

updates #161 Proper error messages and include server response

parent e0aaeb66
...@@ -151,10 +151,7 @@ ...@@ -151,10 +151,7 @@
'message': this.get('get') 'message': this.get('get')
}); });
} else { } else {
this.save({ xhr.onerror();
'upload': _converse.FAILURE,
'message': __('Sorry, could not succesfully upload your file')
});
} }
} }
}; };
...@@ -164,9 +161,14 @@ ...@@ -164,9 +161,14 @@
} }
}, false); }, false);
xhr.onerror = () => { 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({ this.save({
'type': 'error',
'upload': _converse.FAILURE, 'upload': _converse.FAILURE,
'message': __('Sorry, could not succesfully upload your file') 'message': message
}); });
}; };
xhr.open('PUT', this.get('put'), true); xhr.open('PUT', this.get('put'), true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment