1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-18 05:42:00 +03:00

Fix tests by returning the original promise to avoid the extra trip around the event loop.

This commit is contained in:
David Baker
2016-03-15 14:15:15 +00:00
parent 85f2754300
commit 9f91995f4e

View File

@@ -271,14 +271,18 @@ module.exports.MatrixHttpApi.prototype = {
if (!queryParams) { queryParams = {}; }
queryParams.access_token = this.opts.accessToken;
var self = this;
return this.request(
var request_promise = this.request(
callback, method, path, queryParams, data, localTimeoutMs
).catch(function(err) {
);
request_promise.catch(function(err) {
if (err.errcode == 'M_UNKNOWN_TOKEN') {
self.event_emitter.emit("Session.logged_out");
}
throw err;
});
// return the original promise, otherwise tests break due to it having to
// go around the event loop one more time to process the result of the request
return request_promise;
},
/**