Skip to content

Commit

Permalink
chore: Catch error when loading avatars
Browse files Browse the repository at this point in the history
  • Loading branch information
nesium committed Sep 12, 2024
1 parent decabec commit 1a621ef
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/broker/modules/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1a621ef

Please sign in to comment.