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:
@@ -64,9 +64,11 @@ export default class Connection {
|
|||||||
this.logger = loggerService.getLogger('streaming', 'coral');
|
this.logger = loggerService.getLogger('streaming', 'coral');
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async fetch() {
|
public async fetch() {
|
||||||
if (this.user == null) return;
|
if (this.user == null) return;
|
||||||
|
|
||||||
|
try {
|
||||||
const [userProfile, following, followingChannels, userIdsWhoMeMuting, userIdsWhoBlockingMe, userIdsWhoMeMutingRenotes] = await Promise.all([
|
const [userProfile, following, followingChannels, userIdsWhoMeMuting, userIdsWhoBlockingMe, userIdsWhoMeMutingRenotes] = await Promise.all([
|
||||||
this.cacheService.userProfileCache.fetch(this.user.id),
|
this.cacheService.userProfileCache.fetch(this.user.id),
|
||||||
this.cacheService.userFollowingsCache.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.userBlockedCache.fetch(this.user.id),
|
||||||
this.cacheService.renoteMutingsCache.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.userProfile = userProfile;
|
||||||
this.following = following;
|
this.following = following;
|
||||||
this.followingChannels = followingChannels;
|
this.followingChannels = followingChannels;
|
||||||
@@ -82,6 +90,14 @@ export default class Connection {
|
|||||||
this.userIdsWhoBlockingMe = userIdsWhoBlockingMe;
|
this.userIdsWhoBlockingMe = userIdsWhoBlockingMe;
|
||||||
this.userIdsWhoMeMutingRenotes = userIdsWhoMeMutingRenotes;
|
this.userIdsWhoMeMutingRenotes = userIdsWhoMeMutingRenotes;
|
||||||
this.userMutedInstances = new Set(userProfile.mutedInstances);
|
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
|
@bindThis
|
||||||
|
|||||||
Reference in New Issue
Block a user