Skip to content

Commit 1476801

Browse files
Revert unnecessary nested try/catches in RPC fallback calls
These are no different from any other event handler — let rejections propagate naturally. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2b07efd commit 1476801

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

nodejs/src/session.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,7 @@ export class CopilotSession {
370370
} catch (error) {
371371
const message =
372372
error instanceof Error ? error.message : String(error);
373-
try {
374-
await this.rpc.tools.handlePendingToolCall({ requestId, error: message });
375-
} catch {
376-
// Connection may have been disposed; nothing more we can do.
377-
}
373+
await this.rpc.tools.handlePendingToolCall({ requestId, error: message });
378374
}
379375
}
380376

@@ -392,16 +388,12 @@ export class CopilotSession {
392388
});
393389
await this.rpc.permissions.handlePendingPermissionRequest({ requestId, result });
394390
} catch (_error) {
395-
try {
396-
await this.rpc.permissions.handlePendingPermissionRequest({
397-
requestId,
398-
result: {
399-
kind: "denied-no-approval-rule-and-could-not-request-from-user",
400-
},
401-
});
402-
} catch {
403-
// Connection may have been disposed; nothing more we can do.
404-
}
391+
await this.rpc.permissions.handlePendingPermissionRequest({
392+
requestId,
393+
result: {
394+
kind: "denied-no-approval-rule-and-could-not-request-from-user",
395+
},
396+
});
405397
}
406398
}
407399

0 commit comments

Comments
 (0)