mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
better error handling in RoomBeingCreated
This commit is contained in:
parent
d6d1af13d0
commit
f12841b2d3
@ -117,6 +117,7 @@ export class RoomBeingCreated extends EventEmitter<{change: never}> {
|
||||
|
||||
/** @internal */
|
||||
async create(hsApi: HomeServerApi, log: ILogItem): Promise<void> {
|
||||
try {
|
||||
let avatarEventContent;
|
||||
if (this.options.avatar) {
|
||||
const {avatar} = this.options;
|
||||
@ -154,7 +155,6 @@ export class RoomBeingCreated extends EventEmitter<{change: never}> {
|
||||
content: avatarEventContent
|
||||
});
|
||||
}
|
||||
try {
|
||||
const response = await hsApi.createRoom(createOptions, {log}).response();
|
||||
this._roomId = response["room_id"];
|
||||
} catch (err) {
|
||||
@ -170,6 +170,7 @@ export class RoomBeingCreated extends EventEmitter<{change: never}> {
|
||||
* is running. */
|
||||
/** @internal */
|
||||
async loadProfiles(hsApi: HomeServerApi, log: ILogItem): Promise<void> {
|
||||
try {
|
||||
// only load profiles if we need it for the room name and avatar
|
||||
if (!this.options.name && this.options.invites) {
|
||||
this.profiles = await loadProfiles(this.options.invites, hsApi, log);
|
||||
@ -180,6 +181,7 @@ export class RoomBeingCreated extends EventEmitter<{change: never}> {
|
||||
this._calculatedName = calculateRoomName(this.profiles, summaryData, log);
|
||||
this.emitChange();
|
||||
}
|
||||
} catch (err) {} // swallow error, loading profiles is not essential
|
||||
}
|
||||
|
||||
private emitChange(params?: string) {
|
||||
|
Loading…
Reference in New Issue
Block a user