Skip to content

Commit 917f77d

Browse files
rbenzingclaude
andcommitted
fix: narrow GetGroupInfoAsync exception scope to KeyNotFoundException only
Broad catch (Exception) in GetGroupInfoAsync was swallowing all errors (ObjectDisposedException, InvalidOperationException, etc.) and returning null, causing JoinGroupAsync to silently fall through to "create new group" on non-not-found errors. Changed to catch (KeyNotFoundException) only and removed the LogError call on the not-found path (it is the expected hot path when joining a new group, not an error condition). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6c166d2 commit 917f77d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

LibEmiddle/API/LibEmiddleClient.Group.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,11 @@ public async Task<bool> LeaveGroupAsync(string groupId)
288288
LoggingManager.LogDebug(nameof(LibEmiddleClient), $"Retrieved group info for {groupId}");
289289
return groupSession;
290290
}
291-
catch (Exception ex)
291+
catch (KeyNotFoundException)
292292
{
293-
LoggingManager.LogError(nameof(LibEmiddleClient),
294-
$"Failed to get group info for {groupId}: {ex.Message}");
293+
// Group not found — expected path when joining a new group, not an error
295294
return null;
296295
}
296+
// All other exceptions (ObjectDisposedException, InvalidOperationException, etc.) propagate
297297
}
298298
}

0 commit comments

Comments
 (0)