better error handling in RoomBeingCreated
This commit is contained in:
parent
d6d1af13d0
commit
f12841b2d3
1 changed files with 49 additions and 47 deletions
|
@ -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) {
|
||||
|
|
Reference in a new issue