From 1a621ef627192a4e2d6c56391a94aad58b3921ed Mon Sep 17 00:00:00 2001 From: mb Date: Thu, 12 Sep 2024 17:53:21 +0200 Subject: [PATCH] chore: Catch error when loading avatars --- src/broker/modules/profile.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/broker/modules/profile.ts b/src/broker/modules/profile.ts index aec64c16..aa42bc3a 100644 --- a/src/broker/modules/profile.ts +++ b/src/broker/modules/profile.ts @@ -78,10 +78,17 @@ class BrokerModuleProfile extends BrokerModule { logger.info(`Will load avatar for: '${userId}' (ID ${avatar.id})`); - const dataURL = await this._client.client?.loadAvatarDataURL(avatar); - - if (dataURL) { - return { dataURL }; + try { + const dataURL = await this._client.client?.loadAvatarDataURL(avatar); + + if (dataURL) { + return { dataURL }; + } + } catch (error) { + logger.warn( + `Failed to load avatar for ${userId} (ID ${avatar.id})`, + error + ); } return undefined;