fix(client): use StreamableHTTPError instead of plain Error in send() (#1178)

Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
This commit is contained in:
Kazuki Yamada 2025-11-28 22:09:07 +09:00 • committed by GitHub
commit 6b90e1ada8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -209,7 +209,7 @@ describe('StreamableHTTPClientTransport', () => {
const errorSpy = vi.fn();
transport.onerror = errorSpy;
await expect(transport.send(message)).rejects.toThrow('Error POSTing to endpoint (HTTP 404)');
await expect(transport.send(message)).rejects.toThrow('Streamable HTTP error: Error POSTing to endpoint: Session not found');
expect(errorSpy).toHaveBeenCalled();
});

View file

@ -534,7 +534,7 @@ export class StreamableHTTPClientTransport implements Transport {
}
}
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${text}`);
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${text}`);
}
// Reset auth loop flag on successful response