1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Pass the http status out with the error so upper level can can see what went wrong.

This commit is contained in:
David Baker
2015-12-03 10:51:09 +00:00
parent 92ea275275
commit 7f5ad041cc

View File

@@ -117,13 +117,17 @@ module.exports.MatrixHttpApi.prototype = {
clearTimeout(xhr.timeout_timer);
if (!xhr.responseText) {
cb(new Error('No response body.'));
var err = new Error('No response body.');
err.http_status = xhr.status;
cb(err);
return;
}
var resp = JSON.parse(xhr.responseText);
if (resp.content_uri === undefined) {
cb(new Error('Bad response'));
var err = Error('Bad response');
err.http_status = xhr.status;
cb(err);
return;
}