Skip to content

Commit 6b90e1a

Browse files
fix(client): use StreamableHTTPError instead of plain Error in send() (#1178)
Co-authored-by: Matt <[email protected]>
1 parent 5e97e1a commit 6b90e1a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/client/streamableHttp.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ describe('StreamableHTTPClientTransport', () => {
209209
const errorSpy = vi.fn();
210210
transport.onerror = errorSpy;
211211

212-
await expect(transport.send(message)).rejects.toThrow('Error POSTing to endpoint (HTTP 404)');
212+
await expect(transport.send(message)).rejects.toThrow('Streamable HTTP error: Error POSTing to endpoint: Session not found');
213213
expect(errorSpy).toHaveBeenCalled();
214214
});
215215

src/client/streamableHttp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ export class StreamableHTTPClientTransport implements Transport {
534534
}
535535
}
536536

537-
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${text}`);
537+
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${text}`);
538538
}
539539

540540
// Reset auth loop flag on successful response

0 commit comments

Comments
 (0)