Report errors sending cancellation

This commit is contained in:
Justin Spahr-Summers 2024-11-16 16:31:45 +00:00
commit 35396f4a8d
No known key found for this signature in database

View file

@ -418,14 +418,18 @@ export abstract class Protocol<
this._responseHandlers.delete(messageId);
this._progressHandlers.delete(messageId);
this._transport?.send({
jsonrpc: "2.0",
method: "cancelled",
params: {
requestId: messageId,
reason: String(reason),
},
});
this._transport
?.send({
jsonrpc: "2.0",
method: "cancelled",
params: {
requestId: messageId,
reason: String(reason),
},
})
.catch((error) =>
this._onerror(new Error(`Failed to send cancellation: ${error}`)),
);
reject(reason);
};