fix(client): remove redundant onerror in _startOrAuthSse catch#1826
Open
felixweinberger wants to merge 2 commits intomainfrom
Open
fix(client): remove redundant onerror in _startOrAuthSse catch#1826felixweinberger wants to merge 2 commits intomainfrom
felixweinberger wants to merge 2 commits intomainfrom
Conversation
_startOrAuthSse's catch block fired onerror then threw. All three callers (streamableHttp.ts:344, :531, :642) already .catch(error => this.onerror?.(error)), so every failure double-fired. Removed the internal call; callers handle it. Fixes #868 Co-authored-by: Anil Kumar <anilkumar567849@gmail.com>
_startOrAuthSse's catch block fired onerror then threw. All three callers (streamableHttp.ts:344, :531, :642) already .catch(error => this.onerror?.(error)), so every failure double-fired. Removed the internal call; callers handle it. Fixes #868 Co-authored-by: Anil Kumar <anilkumar567849@gmail.com>
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Removes the redundant
onerrorcall in_startOrAuthSse's catch block.Motivation and Context
Fixes #868.
_startOrAuthSse's catch block firedonerrorthen threw. All three callers (streamableHttp.ts:344, :531, :642) already.catch(error => this.onerror?.(error)), so every failure double-fired.This is the approach from #880 (closed for inactivity). @Anil567849 is credited as co-author.
How Has This Been Tested?
Added a regression test that triggers
_startOrAuthSsevia the initialized-notification path (202 response → GET fails) and assertsonerrorfires exactly once. Test fails on main (expected 1 times, but got 2 times), passes with the fix.Breaking Changes
None.
Types of changes
Checklist
Additional context
Two other methods have the same fire-then-throw pattern (
_sendat :681,terminateSessionat :730), but their callersawaitrather than.catch(onerror), so the redundancy there is less clear-cut. Scoping this PR to the verified double-fire.