1
0
mirror of https://git.boykissers.com/pawkey/pawkey-sk.git synced 2025-12-20 04:04:16 +00:00

Added minor error handling for Userid not found

This commit is contained in:
Pawzy
2025-10-19 17:52:19 -05:00
parent e740ecdb3b
commit 1463100e6d

View File

@@ -67,6 +67,8 @@ export default class Connection {
@bindThis
public async fetch() {
if (this.user == null) return;
try {
const [userProfile, following, followingChannels, userIdsWhoMeMuting, userIdsWhoBlockingMe, userIdsWhoMeMutingRenotes] = await Promise.all([
this.cacheService.userProfileCache.fetch(this.user.id),
this.cacheService.userFollowingsCache.fetch(this.user.id),
@@ -75,6 +77,12 @@ export default class Connection {
this.cacheService.userBlockedCache.fetch(this.user.id),
this.cacheService.renoteMutingsCache.fetch(this.user.id),
]);
if (userProfile == null) {
this.logger.warn(`User profile was null for user ${this.user.id}, closing connection.`);
this.wsConnection.close();
return;
}
this.userProfile = userProfile;
this.following = following;
this.followingChannels = followingChannels;
@@ -82,6 +90,14 @@ export default class Connection {
this.userIdsWhoBlockingMe = userIdsWhoBlockingMe;
this.userIdsWhoMeMutingRenotes = userIdsWhoMeMutingRenotes;
this.userMutedInstances = new Set(userProfile.mutedInstances);
} catch (error) {
if (error && typeof error === 'object' && 'name' in error && error.name === 'EntityNotFoundError') {
this.logger.warn(`User profile not found for user ${this.user.id}. Closing connection.`);
} else {
this.logger.error(`An unexpected error occurred during fetch for user ${this.user.id}: ${String(error)}`);
}
this.wsConnection.close();
}
}
@bindThis