From cb4bc061720b3515fb9fe85999c94030e7c5b6e7 Mon Sep 17 00:00:00 2001 From: Will Hunt <will@half-shot.uk> Date: Wed, 15 May 2019 22:11:26 +0100 Subject: [PATCH] Tweak unbridge --- src/channelsyncroniser.ts | 2 -- src/provisioner.ts | 8 +++++--- src/util.ts | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/channelsyncroniser.ts b/src/channelsyncroniser.ts index e2aa65e..9f24d6f 100644 --- a/src/channelsyncroniser.ts +++ b/src/channelsyncroniser.ts @@ -289,7 +289,6 @@ export class ChannelSyncroniser { const intent = await this.bridge.getIntent(); const options = overrideOptions || this.config.channel.deleteOptions; const plumbed = entry.remote!.get("plumbed"); - // tslint:disable-next-line: no-any await this.roomStore.upsertEntry(entry); if (options.ghostsLeave) { @@ -364,7 +363,6 @@ export class ChannelSyncroniser { } } - // Remove entry await this.roomStore.removeEntriesByMatrixRoomId(roomId); } } diff --git a/src/provisioner.ts b/src/provisioner.ts index 4f92ca7..46b7624 100644 --- a/src/provisioner.ts +++ b/src/provisioner.ts @@ -59,9 +59,11 @@ export class Provisioner { roomsToUnbridge = roomsRes.map((entry) => entry.matrix!.roomId); } await Promise.all(roomsToUnbridge.map( async (roomId) => { - return this.channelSync.OnUnbridge(channel, roomId).catch((err) => { - log.error(`Failed to cleanly unbridge ${channel.id} ${channel.guild} from ${roomId}`); - }); + try { + await this.channelSync.OnUnbridge(channel, roomId); + } catch (ex) { + log.error(`Failed to cleanly unbridge ${channel.id} ${channel.guild} from ${roomId}`, ex); + } })); await this.roomStore.removeEntriesByRemoteRoomId(remoteRoom.getId()); } diff --git a/src/util.ts b/src/util.ts index 87555ca..68fe972 100644 --- a/src/util.ts +++ b/src/util.ts @@ -29,13 +29,13 @@ const HTTP_OK = 200; import { Log } from "./log"; const log = new Log("Util"); -type PERMISSIONTYPES = any; // tslint:disable-line no-any +type PERMISSIONTYPES = any | any[]; // tslint:disable-line no-any export interface ICommandAction { description?: string; help?: string; params: string[]; - permission?: PERMISSIONTYPES | PERMISSIONTYPES[]; + permission?: PERMISSIONTYPES; run(params: any): Promise<any>; // tslint:disable-line no-any } @@ -336,9 +336,9 @@ export class Util { const retStr = await action.run(params); return retStr; } catch (e) { - return `**ERROR:** ${e.message}`; log.error("Error processing command"); log.error(e); + return `**ERROR:** ${e.message}`; } } -- GitLab