豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit aecc4a7

Browse files
OregandCopilot
andcommitted
Handle cancellation in auth flow; use logService.error with Error arg
Address review feedback on PR #5078: - Handle isCancellationError (and token.isCancellationRequested) by throwing CancellationError instead of the generic auth-failed error, so user-dismissed sign-in prompts cancel cleanly. - Use logService.error(error, 'Authorization failed') per ILogService guidance rather than interpolating the error into the message string. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d0945a9 commit aecc4a7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { DeferredPromise, retry, RunOnceScheduler } from '../../../util/vs/base/
2424
import { Event } from '../../../util/vs/base/common/event';
2525
import { Disposable, DisposableStore, toDisposable } from '../../../util/vs/base/common/lifecycle';
2626
import { ResourceMap } from '../../../util/vs/base/common/map';
27+
import { CancellationError, isCancellationError } from '../../../util/vs/base/common/errors';
2728
import { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation';
2829
import { SingleSlotTtlCache, TtlCache } from '../common/ttlCache';
2930
import { isUntitledSessionId } from '../common/utils';
@@ -1698,7 +1699,10 @@ export class CopilotCloudSessionsProvider extends Disposable implements vscode.C
16981699
try {
16991700
await this._authenticationService.getGitHubSession('permissive', { createIfNone: { detail: l10n.t('Sign in to GitHub with additional permissions to use Copilot cloud sessions.') } });
17001701
} catch (error) {
1701-
this.logService.error(`Authorization failed: ${error}`);
1702+
if (isCancellationError(error) || token.isCancellationRequested) {
1703+
throw new CancellationError();
1704+
}
1705+
this.logService.error(error, 'Authorization failed');
17021706
throw new Error(vscode.l10n.t('Authorization failed. Please sign into GitHub and try again.'));
17031707
}
17041708
if (!this._authenticationService.permissiveGitHubSession) {

0 commit comments

Comments
 (0)