You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
Add safety for when the endpoint doesn't exist
This commit is contained in:
@@ -408,9 +408,11 @@ MatrixClient.prototype.getCapabilities = function() {
|
|||||||
return Promise.resolve(this._cachedCapabilities.capabilities);
|
return Promise.resolve(this._cachedCapabilities.capabilities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We swallow errors because we need a default object anyhow
|
||||||
return this._http.authedRequest(
|
return this._http.authedRequest(
|
||||||
undefined, "GET", "/capabilities",
|
undefined, "GET", "/capabilities",
|
||||||
).then((r) => {
|
).catch(() => null).then((r) => {
|
||||||
if (!r) r = {};
|
if (!r) r = {};
|
||||||
const capabilities = r["capabilities"] || {};
|
const capabilities = r["capabilities"] || {};
|
||||||
this._cachedCapabilities = {
|
this._cachedCapabilities = {
|
||||||
|
|||||||
Reference in New Issue
Block a user