diff --git a/changelog.d/823.bugfix b/changelog.d/823.bugfix new file mode 100644 index 0000000000000000000000000000000000000000..4e4b072bca3a2b96d8d83c54b745ff80a4b37b33 --- /dev/null +++ b/changelog.d/823.bugfix @@ -0,0 +1 @@ +Make sure we don't lose errors thrown when checking usage limits. diff --git a/src/bot.ts b/src/bot.ts index 73c0345ad87f8b733fe848901127159b6a7baed2..2e34e56ff1987dc070b5d6482536dbc9b159efb6 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -218,7 +218,9 @@ export class DiscordBot { if (this.config.bridge.userLimit !== null) { log.info(`Bridge blocker is enabled with a user limit of ${this.config.bridge.userLimit}`); this.bridgeBlocker = new DiscordBridgeBlocker(this.config.bridge.userLimit, this); - this.bridgeBlocker?.checkLimits(activeUsers); + this.bridgeBlocker?.checkLimits(activeUsers).catch(err => { + log.error(`Failed to check bridge limits: ${err}`); + }); } } @@ -1235,7 +1237,9 @@ export class DiscordBot { await this.store.storeUserActivity(userId, state.dataSet.users[userId]); } log.verbose(`Checking bridge limits (${state.activeUsers} active users)`); - this.bridgeBlocker?.checkLimits(state.activeUsers); + this.bridgeBlocker?.checkLimits(state.activeUsers).catch(err => { + log.error(`Failed to check bridge limits: ${err}`); + });; MetricPeg.get.setRemoteMonthlyActiveUsers(state.activeUsers); } } @@ -1278,7 +1282,9 @@ class AdminNotifier { await this.client.inviteUser(mxid, roomId); } catch (err) { log.verbose(`Failed to invite ${mxid} to ${roomId}, cleaning up`); - this.client.leaveRoom(roomId); // no point awaiting it, nothing we can do if we fail + this.client.leaveRoom(roomId).catch(err => { + log.error(`Failed to clean up to-be-DM room ${roomId}: ${err}`); + }); throw err; }