Merge pull request #1338 from matrix-org/dbkr/getAccountDataFromServer_404

Make getAccountDataFromServer return null if not found
This commit is contained in:
David Baker
2020-04-21 15:10:13 +01:00
committed by GitHub
+11 -3
View File
@@ -2135,9 +2135,17 @@ MatrixClient.prototype.getAccountDataFromServer = async function(eventType) {
$userId: this.credentials.userId,
$type: eventType,
});
return this._http.authedRequest(
undefined, "GET", path, undefined,
);
try {
const result = await this._http.authedRequest(
undefined, "GET", path, undefined,
);
return result;
} catch (e) {
if (e.data && e.data.errcode === 'M_NOT_FOUND') {
return null;
}
throw e;
}
};
/**