You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrap Discord GatewayPlugin handleReconnectionAttempt with a reconnection error guard to prevent uncaught exceptions when max reconnect attempts are reached.
Emit gateway error events from the guard so existing lifecycle error handling can handle shutdown/restart flow.
Add regression coverage for handleReconnectionAttempt failure handling in monitor plugin creation tests.
This PR adds a withReconnectionErrorHandling wrapper in gateway-plugin.ts that catches exceptions thrown by GatewayPlugin.handleReconnectionAttempt (e.g., when max reconnect attempts are exhausted), emits a gateway error event so existing lifecycle error handling can drive shutdown/restart, and logs the failure via runtime.error. The wrapper is applied to all three instantiation paths. A regression test is added to provider.proxy.test.ts that verifies the error guard catches failures from handleReconnectionAttempt and emits the expected error event through the gateway emitter.
The implementation is sound: closure captures correctly bind plugin and originalHandleReconnectionAttempt even when the method is extracted, and the test confirms the wrapped behavior resolves cleanly with proper error emission.
Confidence Score: 5/5
This PR is safe to merge. The error-guard wrapper is well-scoped, correctly implemented, and properly tested with no identified defects.
The error handling logic is sound and addresses a real crash path when max reconnect attempts are exhausted. The closure captures are correct, the wrapper is applied consistently across all instantiation paths, and the test validates the error-emission behavior works as intended. No blocking issues or concerning patterns identified.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary