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

Merge pull request 'Added minor error handling for Userid not found' (#1) from fix/user-not-found-error into stable-priv

Reviewed-on: https://git.pawlickers.org/leafus/pawkey/pulls/1
This commit is contained in:
Leafus
2025-10-28 03:19:28 +00:00

View File

@@ -64,9 +64,11 @@ export default class Connection {
this.logger = loggerService.getLogger('streaming', 'coral');
}
@bindThis
@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