forked from mystiq/hydrogen-web
Return null on error
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
bb68b4d367
commit
e363d32921
1 changed files with 10 additions and 1 deletions
|
@ -108,7 +108,16 @@ async function loadMember({roomId, userId, storage}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchMember({roomId, userId, hsApi, storage}, log) {
|
async function fetchMember({roomId, userId, hsApi, storage}, log) {
|
||||||
const memberData = await hsApi.state(roomId, "m.room.member", userId, {log}).response();
|
let memberData;
|
||||||
|
try {
|
||||||
|
memberData = await hsApi.state(roomId, "m.room.member", userId, { log }).response();
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
if (error.name === "HomeServerError" && error.errcode === "M_NOT_FOUND") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
const member = new RoomMember({
|
const member = new RoomMember({
|
||||||
roomId,
|
roomId,
|
||||||
userId,
|
userId,
|
||||||
|
|
Loading…
Reference in a new issue